Skip to content

Commit

Permalink
Update tests to be better
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonhoc committed Apr 15, 2024
1 parent da493f3 commit aa4e8bf
Showing 1 changed file with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
it 'and a result that matches our schema is successfully returned with the 200 status ' do
VCR.use_cassette(good_claims_response_vcr_path) do
VCR.use_cassette('mobile/appeals/appeals') do
original_evss_claims_count = EVSSClaim.count
get('/mobile/v0/claims-and-appeals-overview', headers: sis_headers, params:)
expect(EVSSClaim.count).not_to eq(original_evss_claims_count)
expect(response).to have_http_status(:ok)
# check a couple entries to make sure the data is correct
parsed_response_contents = response.parsed_body['data']
Expand Down Expand Up @@ -487,6 +485,36 @@
end
end
end

describe 'EVSSClaim count' do
it 'creates record if it does not exist' do
VCR.use_cassette(good_claims_response_vcr_path) do
VCR.use_cassette('mobile/appeals/appeals') do
expect do
get('/mobile/v0/claims-and-appeals-overview', headers: sis_headers, params:)
end.to change(EVSSClaim, :count)
end
end
end

it 'updates record if it does exist' do
VCR.use_cassette(good_claims_response_vcr_path) do
VCR.use_cassette('mobile/appeals/appeals') do
evss_id = lighthouse_flag ? 600_383_363 : 600_114_693
claim = EVSSClaim.create(user_uuid: sis_user.uuid,
user_account: sis_user.user_account,
evss_id:,
created_at: 1.week.ago,
updated_at: 1.week.ago,
data: {})
expect do
get('/mobile/v0/claims-and-appeals-overview', headers: sis_headers, params:)
claim.reload
end.to change(claim, :updated_at)
end
end
end
end
end
end

Expand Down

0 comments on commit aa4e8bf

Please sign in to comment.