Skip to content

Commit

Permalink
FYST-1721 AZ include qual child dependent only if filer is hoh (#5475)
Browse files Browse the repository at this point in the history
  • Loading branch information
tahsinaislam authored Jan 29, 2025
1 parent a4dacde commit 2ae4a0c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
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?
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

0 comments on commit 2ae4a0c

Please sign in to comment.