From 98ab588be144b8bb601d62bb1b6ac230617de170 Mon Sep 17 00:00:00 2001 From: Gregory Hedrick Date: Tue, 21 Jan 2025 11:37:40 -0500 Subject: [PATCH] Fix specs --- .../v0/power_of_attorney_requests_spec.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/accredited_representative_portal/spec/requests/accredited_representative_portal/v0/power_of_attorney_requests_spec.rb b/modules/accredited_representative_portal/spec/requests/accredited_representative_portal/v0/power_of_attorney_requests_spec.rb index f6bf7882149..cbcb3bbf839 100644 --- a/modules/accredited_representative_portal/spec/requests/accredited_representative_portal/v0/power_of_attorney_requests_spec.rb +++ b/modules/accredited_representative_portal/spec/requests/accredited_representative_portal/v0/power_of_attorney_requests_spec.rb @@ -27,8 +27,8 @@ def load_response_fixture(path_suffix) resolution.power_of_attorney_request end - let(:time) { '2024-12-21T04:45:37Z' } - let(:time_plus_one_day) { '2024-12-22T04:45:37Z' } + let(:time) { '2024-12-21T04:45:37.000Z' } + let(:time_plus_one_day) { '2024-12-22T04:45:37.000Z' } let(:expires_at) { '2025-02-19T04:45:37.000Z' } let(:poa_requests) do @@ -184,14 +184,15 @@ def load_response_fixture(path_suffix) context 'when providing a status param' do let!(:declined_request) { create(:power_of_attorney_request, :with_declination) } - let!(:pending_request) { create(:power_of_attorney_request, skip_resolution: true) } + let!(:pending_request) { create(:power_of_attorney_request) } it 'returns the list of pending power of attorney requests' do get('/accredited_representative_portal/v0/power_of_attorney_requests?status=pending') parsed_response = JSON.parse(response.body) expect(response).to have_http_status(:ok) - expect(parsed_response.length).to eq 1 - expect(parsed_response[0]['id']).to eq pending_request.id + expect(parsed_response.length).to eq 2 + expect(parsed_response.map { |poa| poa['id'] }).to include(pending_request.id) + expect(parsed_response.map { |poa| poa['id'] }).not_to include(declined_request.id) end it 'returns the list of completed power of attorney requests' do @@ -211,6 +212,12 @@ def load_response_fixture(path_suffix) describe 'GET /accredited_representative_portal/v0/power_of_attorney_requests/:id' do let(:poa_request) { create(:power_of_attorney_request, :with_declination) } + let(:power_of_attorney_form) do + poa_request.power_of_attorney_form.parsed_data.tap do |data| + data.delete('dependent') + data['claimant'] = data.delete('veteran') + end + end it 'returns the details of a specific power of attorney request' do get("/accredited_representative_portal/v0/power_of_attorney_requests/#{poa_request.id}") @@ -222,7 +229,7 @@ def load_response_fixture(path_suffix) 'claimant_id' => poa_request.claimant_id, 'created_at' => time, 'expires_at' => nil, - 'power_of_attorney_form' => veteran_claimant_power_of_attorney_form, + 'power_of_attorney_form' => power_of_attorney_form, 'resolution' => { 'id' => poa_request.resolution.id, 'type' => 'decision',