Skip to content

Commit

Permalink
[#1963] Chatbot claims
Browse files Browse the repository at this point in the history
- Raise an exception when claims is called without a conversation id parameter
- Update tests to pass convo id
- Add test to verify that exception is raised
  • Loading branch information
szarrougtw committed Sep 23, 2024
1 parent 504cebc commit db358aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def poll_claims_from_lighthouse
raw_claim_list = lighthouse_service.get_claims['data']
cxdw_reporting_service = V0::VirtualAgent::ReportToCxdw.new
conversation_id = params[:conversation_id]
raise ActionController::ParameterMissing, 'conversation_id' if conversation_id.blank?

begin
claims = order_claims_lighthouse(raw_claim_list)
report_or_error(cxdw_reporting_service, conversation_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
describe 'multiple claims from lighthouse' do
it 'returns ordered list of all veteran claims from lighthouse' do
VCR.use_cassette('lighthouse/benefits_claims/index/claims_chatbot_multiple_claims') do
get '/v0/virtual_agent/claims'
get('/v0/virtual_agent/claims', params: { conversation_id: 123 })
end

expect(response).to have_http_status(:ok)
Expand Down Expand Up @@ -97,7 +97,7 @@
describe 'single claim' do
it 'returns single open compensation claim' do
VCR.use_cassette('lighthouse/benefits_claims/index/claims_chatbot_single_claim') do
get '/v0/virtual_agent/claims'
get('/v0/virtual_agent/claims', params: { conversation_id: 123 })
end

expect(response).to have_http_status(:ok)
Expand Down Expand Up @@ -130,7 +130,7 @@
describe 'no claims' do
it 'returns empty array when no open claims are found' do
VCR.use_cassette('lighthouse/benefits_claims/index/claims_chatbot_zero_claims') do
get '/v0/virtual_agent/claims'
get('/v0/virtual_agent/claims', params: { conversation_id: 123 })
end

expect(response).to have_http_status(:ok)
Expand All @@ -139,6 +139,16 @@
expect(JSON.parse(response.body)['data'].size).to eq(0)
end
end

describe 'no conversation id' do
it 'raises exception when no conversation id is found' do
VCR.use_cassette('lighthouse/benefits_claims/index/claims_chatbot_zero_claims') do
get '/v0/virtual_agent/claims'
end

expect(response).to have_http_status(:bad_request)
end
end
end
end
end

0 comments on commit db358aa

Please sign in to comment.