Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FYST-1721 AZ include qual child dependent only if filer is hoh #5475

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def documents_wrapper
xml_doc = build_xml_doc("Form140") do |xml|
xml.LNPriorYrs sanitize_for_xml(@submission.data_source.prior_last_names)
xml.FilingStatus filing_status
if hoh_qualifying_person.present?
if hoh_qualifying_person.present? && @submission.data_source.filing_status_hoh?
Copy link
Contributor

@arinchoi03 arinchoi03 Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can hoh_qualifying_person exist if filing status is not hoh?
i.e. can we fold in this check into the hoh_qualifying_person logic?
I guess I'm seeing the test coverage and wondering if this is a likely scenario that a :single filer will have an hoh qualifying person.

just return false unless @submission.data_source.filing_status_hoh? in the method perhaps

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah we had a hoh qualifiying dependent on a single filer

xml.QualChildDependentName do
xml.FirstName sanitize_for_xml(hoh_qualifying_person[:first_name], 16)
xml.LastName sanitize_for_xml(hoh_qualifying_person[:last_name], 32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,21 @@
expect(instance.send(:xml_hoh_qualifying_person)).to be_nil
end

# TODO: Write tests for when xml exists, when they exist
context 'when there is qualifying person in the xml' do
let(:intake) do
create(
:state_file_az_intake,
filing_status: :head_of_household,
raw_direct_file_data: StateFile::DirectFileApiResponseSampleService.new.read_xml('az_marge_hoh_no_deps'),
raw_direct_file_intake_data: StateFile::DirectFileApiResponseSampleService.new.read_json('az_marge_hoh_no_deps')
)
end
it 'should return a hash when there is a matching xml element' do
response = instance.send(:xml_hoh_qualifying_person)
expect(response).to be_kind_of(Hash)
expect(response.keys).to eq [:first_name, :last_name]
end
end
end

describe "#json_xml_qualifying_person" do
Expand All @@ -66,6 +80,21 @@
expect(xml.at('QualChildDependentName')).to be_present
expect(xml.at('QualChildDependentName FirstName').text).to eq 'Axel'
end

describe 'when the filing status is not hoh but there is a qualifying person' do
let(:intake) do
create(
:state_file_az_intake,
filing_status: :single,
raw_direct_file_data: StateFile::DirectFileApiResponseSampleService.new.read_xml('az_alexis_hoh'),
raw_direct_file_intake_data: StateFile::DirectFileApiResponseSampleService.new.read_json('az_alexis_hoh')
)
end

it 'does not create the QualChildDependentName' do
expect(xml.at('QualChildDependentName')).to be_nil
end
end
end

context "when there are dependents" do
Expand Down
Loading