From 4f082e5f97b280b50a890b555ea0e9e2c924d340 Mon Sep 17 00:00:00 2001 From: Seth Darr <92405130+sethdarragile6@users.noreply.github.com> Date: Wed, 24 Apr 2024 15:26:20 -0700 Subject: [PATCH] Toxic Exposure: Add basic toxicExposure node to pre-submission JSON (#16450) * add toxicExposure to pre-submission JSON * remove aborted test attempt * fixed malformed JSON in with_everything * rubocop'd it * add TE flipper flag * remove breakpoints * rubocop * fix the with_everything.json * change toxicExposureConditions to conditions --- .../data_translation_all_claim.rb | 9 +++ .../data_translation_all_claim_spec.rb | 30 +++++++++ ...sability_compensation_form_request_spec.rb | 2 + .../all_claims_fe_submission.json | 1 + .../submissions/with_everything.json | 64 ++++++++++++++++++- 5 files changed, 105 insertions(+), 1 deletion(-) diff --git a/lib/evss/disability_compensation_form/data_translation_all_claim.rb b/lib/evss/disability_compensation_form/data_translation_all_claim.rb index 8eda0195f33..dd7b695d1a0 100644 --- a/lib/evss/disability_compensation_form/data_translation_all_claim.rb +++ b/lib/evss/disability_compensation_form/data_translation_all_claim.rb @@ -62,6 +62,7 @@ def translate output_form.update(translate_veteran) output_form.update(translate_treatments) output_form.update(translate_disabilities) + output_form.update(add_toxic_exposure) if Flipper.enabled?(:disability_526_toxic_exposure, @current_user) @translated_form end @@ -629,6 +630,14 @@ def map_secondary(input_disability, disabilities) end end + ### + # Toxic Exposure + ### + + def add_toxic_exposure + { 'toxicExposure' => input_form['toxicExposure'] } + end + def application_expiration_date 1.year.from_now.iso8601 end diff --git a/spec/lib/evss/disability_compensation_form/data_translation_all_claim_spec.rb b/spec/lib/evss/disability_compensation_form/data_translation_all_claim_spec.rb index 0d000d350b5..88ac3800b51 100644 --- a/spec/lib/evss/disability_compensation_form/data_translation_all_claim_spec.rb +++ b/spec/lib/evss/disability_compensation_form/data_translation_all_claim_spec.rb @@ -1451,6 +1451,36 @@ end end + describe '#add_toxic_exposure' do + let(:form_content) do + { + 'form526' => { + 'toxicExposure' => { + 'gulfWar1990' => { + 'iraq' => true, + 'kuwait' => true, + 'qatar' => true + } + } + } + } + end + + it 'returns toxic exposure' do + expect(subject.send(:add_toxic_exposure)).to eq( + { + 'toxicExposure' => { + 'gulfWar1990' => { + 'iraq' => true, + 'kuwait' => true, + 'qatar' => true + } + } + } + ) + end + end + describe '#application_expiration_date' do it 'returns the application creation date + 365 days' do expect(subject.send(:application_expiration_date)).to eq '2021-11-05T18:19:50Z' diff --git a/spec/requests/disability_compensation_form_request_spec.rb b/spec/requests/disability_compensation_form_request_spec.rb index eb08c9a4385..6825d965218 100644 --- a/spec/requests/disability_compensation_form_request_spec.rb +++ b/spec/requests/disability_compensation_form_request_spec.rb @@ -242,6 +242,8 @@ def test_error(cassette_path, status, headers) post('/v0/disability_compensation_form/submit_all_claim', params: all_claims_form, headers:) expect(response).to have_http_status(:ok) expect(response).to match_response_schema('submit_disability_form') + form = Form526Submission.last.form + expect(form.dig('form526', 'form526', 'toxicExposure')).not_to eq(nil) end it 'matches the rated disabilites schema with camel-inflection' do diff --git a/spec/support/disability_compensation_form/all_claims_fe_submission.json b/spec/support/disability_compensation_form/all_claims_fe_submission.json index 648eff4fd18..200e53e75c2 100644 --- a/spec/support/disability_compensation_form/all_claims_fe_submission.json +++ b/spec/support/disability_compensation_form/all_claims_fe_submission.json @@ -144,6 +144,7 @@ ] } ], + "toxicExposure": {}, "waiveRetirementPay": false, "waiveTrainingPay": true, "hasTrainingPay": true diff --git a/spec/support/disability_compensation_form/submissions/with_everything.json b/spec/support/disability_compensation_form/submissions/with_everything.json index 1fb50701faa..d93f8ff4aa9 100644 --- a/spec/support/disability_compensation_form/submissions/with_everything.json +++ b/spec/support/disability_compensation_form/submissions/with_everything.json @@ -191,7 +191,69 @@ } ] } - ] + ], + "toxicExposure": { + "gulfWar1990": { + "iraq": true, + "kuwait": true, + "qatar": true + }, + "gulfWar1990Details": { + "iraq": { + "startDate": "1991-03-01", + "endDate": "1992-01-01" + }, + "qatar": { + "startDate": "1991-02-12", + "endDate": "1991-06-01" + }, + "kuwait": { + "startDate": "1991-03-15" + } + }, + "herbicide": { + "cambodia": true, + "guam": true, + "laos": true + }, + "herbicideDetails": { + "cambodia": { + "startDate": "1991-03-01", + "endDate": "1992-01-01" + }, + "guam": { + "startDate": "1991-02-12", + "endDate": "1991-06-01" + }, + "laos": { + "startDate": "1991-03-15" + } + }, + "otherHerbicideLocations": "freeform text field.", + "otherExposures": { + "asbestos": true, + "radiation": true, + "mustardgas": false + }, + "otherExposureDetails": { + "asbestos": { + "startDate": "1991-03-01", + "endDate": "1992-01-01" + }, + "radiation": { + "startDate": "1991-03-01", + "endDate": "1992-01-01" + } + }, + "specifyOtherExposures": { + "description": "Lead, burn pits", + "startDate": "1991-03-01", + "endDate": "1992-01-01" + }, + "conditions": { + "deviatedseptum": true + } + } } }, "form526_uploads": [