Skip to content

Commit

Permalink
Force output form to have '2019' as startedFormVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
tommasina-va committed Dec 20, 2024
1 parent 36a2f78 commit 8a44b69
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ def translate
output_form['overflowText'] = overflow_text
output_form['bddQualified'] = bdd_qualified?
output_form['claimSubmissionSource'] = 'VA.gov'
# any form that has a startedFormVersion (whether it is '2019' or '2022')
# will go through the Toxic Exposure flow
output_form['startedFormVersion'] = input_form['startedFormVersion'] || nil
output_form.compact!

output_form.update(translate_banking_info)
output_form.update(translate_service_pay)
output_form.update(translate_service_info)
Expand All @@ -72,7 +68,8 @@ def translate
output_form.update(translate_disabilities)
# any form that has a startedFormVersion (whether it is '2019' or '2022')
# will go through the Toxic Exposure flow
output_form.update(add_toxic_exposure) if output_form['startedFormVersion']
output_form.update(translate_started_form_version)
output_form.update(add_toxic_exposure)

@translated_form
end
Expand Down Expand Up @@ -226,6 +223,14 @@ def direct_deposit(type, account_number, routing_number, bank_name)
}
end

###
# Started Form Version
###
def translate_started_form_version
# fixes bug where some InProgressForms were missing startedFormVersion (necessary for Toxic Exposure flow)
{ 'startedFormVersion' => input_form['startedFormVersion'] || '2019' }
end

###
# Service pay
###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,54 @@
end
end

describe '#translateStartedFormVersion' do
context 'no startedFormVersion on input form' do
let(:form_content) do
{
'form526' => {}
}
end

it 'adds in startedFormVersion when it was missing' do
expect(subject.send(:translate_started_form_version)).to eq({
'startedFormVersion' => '2019'
})
end
end

context 'startedFormVersion is 2022' do
let(:form_content) do
{
'form526' => {
'startedFormVersion' => '2022'
}
}
end

it 'adds in startedFormVersion when it was missing' do
expect(subject.send(:translate_started_form_version)).to eq({
'startedFormVersion' => '2022'
})
end
end

context 'startedFormVersion is 2019' do
let(:form_content) do
{
'form526' => {
'startedFormVersion' => '2019'
}
}
end

it 'fills in 2019 startedFormVersion' do
expect(subject.send(:translate_started_form_version)).to eq({
'startedFormVersion' => '2019'
})
end
end
end

describe '#add_toxic_exposure' do
let(:form_content) do
{
Expand Down

0 comments on commit 8a44b69

Please sign in to comment.