chore: Add missing test cases in conversations_controller_spec (#4438)
This commit is contained in:
@@ -7,4 +7,5 @@ json.messages do
|
|||||||
json.partial! 'api/v1/models/widget_message', resource: message
|
json.partial! 'api/v1/models/widget_message', resource: message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
json.custom_attributes @conversation.custom_attributes
|
||||||
json.contact @conversation.contact
|
json.contact @conversation.contact
|
||||||
|
|||||||
@@ -54,19 +54,22 @@ RSpec.describe '/api/v1/widget/conversations/toggle_typing', type: :request do
|
|||||||
website_token: web_widget.website_token,
|
website_token: web_widget.website_token,
|
||||||
contact: {
|
contact: {
|
||||||
name: 'contact-name',
|
name: 'contact-name',
|
||||||
email: 'contact-email@chatwoot.com'
|
email: 'contact-email@chatwoot.com',
|
||||||
|
phone_number: '+919745313456'
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
content: 'This is a test message'
|
content: 'This is a test message'
|
||||||
}
|
},
|
||||||
|
custom_attributes: { order_id: '12345' }
|
||||||
},
|
},
|
||||||
as: :json
|
as: :json
|
||||||
|
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
json_response = JSON.parse(response.body)
|
json_response = JSON.parse(response.body)
|
||||||
|
|
||||||
expect(json_response['id']).not_to eq nil
|
expect(json_response['id']).not_to eq nil
|
||||||
expect(json_response['contact']['email']).to eq 'contact-email@chatwoot.com'
|
expect(json_response['contact']['email']).to eq 'contact-email@chatwoot.com'
|
||||||
|
expect(json_response['contact']['phone_number']).to eq '+919745313456'
|
||||||
|
expect(json_response['custom_attributes']['order_id']).to eq '12345'
|
||||||
expect(json_response['messages'][0]['content']).to eq 'This is a test message'
|
expect(json_response['messages'][0]['content']).to eq 'This is a test message'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user