Skip to content

Commit

Permalink
Update tests and fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
dfong-adh committed Nov 19, 2024
1 parent 28d875b commit 9984270
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
9 changes: 8 additions & 1 deletion spec/sidekiq/decision_review/hlr_status_updater_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,21 @@
allow(Rails.logger).to receive(:info)
end

let(:guid4) { SecureRandom.uuid }
let(:guid5) { SecureRandom.uuid }

it 'does not increment metrics for unchanged form status or existing final statuses' do
SavedClaim::HigherLevelReview.create(guid: guid1, form: '{}', metadata: '{"status":"error"}')
SavedClaim::HigherLevelReview.create(guid: guid2, form: '{}', metadata: '{"status":"submitted"}')
SavedClaim::HigherLevelReview.create(guid: guid3, form: '{}', metadata: '{"status":"pending"}')
SavedClaim::HigherLevelReview.create(guid: guid4, form: '{}', metadata: '{"status":"complete"}')
SavedClaim::HigherLevelReview.create(guid: guid5, form: '{}', metadata: '{"status":"DR_404"}')

expect(service).not_to receive(:get_higher_level_review).with(guid1)
expect(service).to receive(:get_higher_level_review).with(guid2).and_return(response_error)
expect(service).to receive(:get_higher_level_review).with(guid3).and_return(response_pending)
expect(service).not_to receive(:get_higher_level_review).with(guid4)
expect(service).not_to receive(:get_higher_level_review).with(guid5)

subject.new.perform

Expand Down Expand Up @@ -153,7 +160,7 @@
end
end

context 'and it is a permanent error' do
context 'and it is a 404 error' do
let(:exception) { DecisionReviewV1::ServiceException.new(key: 'DR_404') }

it 'updates the status of the record' do
Expand Down
9 changes: 7 additions & 2 deletions spec/sidekiq/decision_review/nod_status_updater_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
let(:guid1) { SecureRandom.uuid }
let(:guid2) { SecureRandom.uuid }
let(:guid3) { SecureRandom.uuid }
let(:guid4) { SecureRandom.uuid }

let(:response_complete) do
response = JSON.parse(VetsJsonSchema::EXAMPLES.fetch('NOD-SHOW-RESPONSE-200_V2').to_json) # deep copy
Expand Down Expand Up @@ -190,6 +189,9 @@
allow(Rails.logger).to receive(:info)
end

let(:guid4) { SecureRandom.uuid }
let(:guid5) { SecureRandom.uuid }

let(:upload_id) { SecureRandom.uuid }
let(:upload_id2) { SecureRandom.uuid }
let(:upload_id3) { SecureRandom.uuid }
Expand Down Expand Up @@ -233,12 +235,15 @@
SavedClaim::NoticeOfDisagreement.create(guid: guid3, form: '{}',
metadata: '{"status":"pending","uploads":[]}')
SavedClaim::NoticeOfDisagreement.create(guid: guid4, form: '{}',
metadata: '{"status":"complete","uploads":[]}')
SavedClaim::NoticeOfDisagreement.create(guid: guid5, form: '{}',
metadata: '{"status":"DR_404","uploads":[]}')

expect(service).not_to receive(:get_notice_of_disagreement).with(guid1)
expect(service).to receive(:get_notice_of_disagreement).with(guid2).and_return(response_error)
expect(service).to receive(:get_notice_of_disagreement).with(guid3).and_return(response_pending)
expect(service).not_to receive(:get_notice_of_disagreement).with(guid4)
expect(service).not_to receive(:get_notice_of_disagreement).with(guid5)

subject.new.perform

Expand Down Expand Up @@ -337,7 +342,7 @@
end
end

context 'and it is a permanent error' do
context 'and it is a 404 error' do
let(:exception) { DecisionReviewV1::ServiceException.new(key: 'DR_404') }

it 'updates the status of the record' do
Expand Down
10 changes: 7 additions & 3 deletions spec/sidekiq/decision_review/sc_status_updater_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
let(:guid1) { SecureRandom.uuid }
let(:guid2) { SecureRandom.uuid }
let(:guid3) { SecureRandom.uuid }
let(:guid4) { SecureRandom.uuid }

let(:response_complete) do
response = JSON.parse(VetsJsonSchema::EXAMPLES.fetch('SC-SHOW-RESPONSE-200_V2').to_json) # deep copy
Expand Down Expand Up @@ -354,6 +353,9 @@
allow(Rails.logger).to receive(:info)
end

let(:guid4) { SecureRandom.uuid }
let(:guid5) { SecureRandom.uuid }

let(:upload_id) { SecureRandom.uuid }
let(:upload_id2) { SecureRandom.uuid }
let(:upload_id3) { SecureRandom.uuid }
Expand Down Expand Up @@ -393,12 +395,14 @@
SavedClaim::SupplementalClaim.create(guid: guid1, form: '{}', metadata: '{"status":"error","uploads":[]}')
SavedClaim::SupplementalClaim.create(guid: guid2, form: '{}', metadata: '{"status":"submitted","uploads":[]}')
SavedClaim::SupplementalClaim.create(guid: guid3, form: '{}', metadata: '{"status":"pending","uploads":[]}')
SavedClaim::SupplementalClaim.create(guid: guid4, form: '{}', metadata: '{"status":"DR_404,"uploads":[]}')
SavedClaim::SupplementalClaim.create(guid: guid4, form: '{}', metadata: '{"status":"complete,"uploads":[]}')
SavedClaim::SupplementalClaim.create(guid: guid5, form: '{}', metadata: '{"status":"DR_404,"uploads":[]}')

expect(service).not_to receive(:get_supplemental_claim).with(guid1)
expect(service).to receive(:get_supplemental_claim).with(guid2).and_return(response_error)
expect(service).to receive(:get_supplemental_claim).with(guid3).and_return(response_pending)
expect(service).not_to receive(:get_supplemental_claim).with(guid4)
expect(service).not_to receive(:get_supplemental_claim).with(guid5)

subject.new.perform

Expand Down Expand Up @@ -500,7 +504,7 @@
end
end

context 'and it is a permanent error' do
context 'and it is a 404 error' do
let(:exception) { DecisionReviewV1::ServiceException.new(key: 'DR_404') }

it 'updates the status of the record' do
Expand Down

0 comments on commit 9984270

Please sign in to comment.