Skip to content

Commit

Permalink
API-23726-remove-leading-space-contentions (#11735)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
stiehlrod authored Feb 9, 2023
1 parent c9f7402 commit 8f68ff2
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand Down
18 changes: 9 additions & 9 deletions modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8f68ff2

Please sign in to comment.