From 8f68ff2b109d7ce96aeecd96f1b8b30dd0dc0640 Mon Sep 17 00:00:00 2001 From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com> Date: Thu, 9 Feb 2023 10:34:15 -0700 Subject: [PATCH] API-23726-remove-leading-space-contentions (#11735) * Adds method to handle contentions, and a new test. * Fixes docs * Adds logic to handle string properly * Removes catch for array based on PR comments * Refactors & adds OAS docs --- .../v2/veterans/claims_controller.rb | 2 +- .../swagger/claims_api/v2/dev/swagger.json | 18 ++++++------ .../claims_api/v2/production/swagger.json | 14 +++++----- .../v2/veterans/claims_request_spec.rb | 28 +++++++++++++++++++ 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/modules/claims_api/app/controllers/claims_api/v2/veterans/claims_controller.rb b/modules/claims_api/app/controllers/claims_api/v2/veterans/claims_controller.rb index eb10c87e160..76241c1e645 100644 --- a/modules/claims_api/app/controllers/claims_api/v2/veterans/claims_controller.rb +++ b/modules/claims_api/app/controllers/claims_api/v2/veterans/claims_controller.rb @@ -174,7 +174,7 @@ def build_claim_structure(data:, lighthouse_id:, upstream_id:) # rubocop:disable claim_type_code: data[:bnft_claim_type_cd], claim_type: data[:claim_status_type], close_date: data[:claim_complete_dt].present? ? format_bgs_date(data[:claim_complete_dt]) : nil, - contention_list: data[:contentions]&.split(','), + contention_list: data[:contentions]&.split(',')&.collect(&:strip) || [], decision_letter_sent: map_yes_no_to_boolean('decision_notification_sent', data[:decision_notification_sent]), development_letter_sent: map_yes_no_to_boolean('development_letter_sent', data[:development_letter_sent]), diff --git a/modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json b/modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json index ea1df410f7d..34b11dc2e90 100644 --- a/modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json +++ b/modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json @@ -736,13 +736,13 @@ "closeDate": "2017-10-18", "contentionList": [ "abnormal heart (New)", - " abscess kidney (New)", - " encephalitis lethargica residuals (New)", - " dracunculiasis (New)", - " gingivitis (New)", - " abnormal weight loss (New)", - " groin condition (New)", - " metritis (New)" + "abscess kidney (New)", + "encephalitis lethargica residuals (New)", + "dracunculiasis (New)", + "gingivitis (New)", + "abnormal weight loss (New)", + "groin condition (New)", + "metritis (New)" ], "decisionLetterSent": false, "developmentLetterSent": false, @@ -1849,8 +1849,8 @@ "id": "1", "type": "intent_to_file", "attributes": { - "creationDate": "2023-02-07", - "expirationDate": "2024-02-07", + "creationDate": "2023-02-09", + "expirationDate": "2024-02-09", "type": "compensation", "status": "active" } diff --git a/modules/claims_api/app/swagger/claims_api/v2/production/swagger.json b/modules/claims_api/app/swagger/claims_api/v2/production/swagger.json index 4f99873aed7..227fbde7c08 100644 --- a/modules/claims_api/app/swagger/claims_api/v2/production/swagger.json +++ b/modules/claims_api/app/swagger/claims_api/v2/production/swagger.json @@ -736,13 +736,13 @@ "closeDate": "2017-10-18", "contentionList": [ "abnormal heart (New)", - " abscess kidney (New)", - " encephalitis lethargica residuals (New)", - " dracunculiasis (New)", - " gingivitis (New)", - " abnormal weight loss (New)", - " groin condition (New)", - " metritis (New)" + "abscess kidney (New)", + "encephalitis lethargica residuals (New)", + "dracunculiasis (New)", + "gingivitis (New)", + "abnormal weight loss (New)", + "groin condition (New)", + "metritis (New)" ], "decisionLetterSent": false, "developmentLetterSent": false, diff --git a/modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb index 2e261a7ac27..e06de79020b 100644 --- a/modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb @@ -813,6 +813,34 @@ end end + describe 'when handling a BGS claim' do + context 'it retrieves the contentions list' do + it 'lists the contentions without leading spaces' do + lh_claim = create(:auto_established_claim, status: 'PENDING', veteran_icn: veteran_id, + evss_id: '111111111') + claim_contentions = bgs_claim_response + claim_contentions[:benefit_claim_details_dto][:contentions] = ' c1, c2, c3' + with_okta_user(scopes) do |auth_header| + VCR.use_cassette('bgs/tracked_items/find_tracked_items') do + VCR.use_cassette('evss/documents/get_claim_documents') do + expect_any_instance_of(BGS::EbenefitsBenefitClaimsStatus) + .to receive(:find_benefit_claim_details_by_benefit_claim_id).and_return(claim_contentions) + expect(ClaimsApi::AutoEstablishedClaim) + .to receive(:get_by_id_and_icn).and_return(lh_claim) + + get claim_by_id_path, headers: auth_header + + json_response = JSON.parse(response.body) + expect(response.status).to eq(200) + claim_contentions_res = json_response['data']['attributes']['contentionList'] + expect(claim_contentions_res).to eq(%w[c1 c2 c3]) + end + end + end + end + end + end + describe "handling the 'supporting_documents'" do context 'it has documents' do it "returns a claim with 'supporting_documents'" do