chore: Create conversation API should accept assignee & team (#3166)
This commit is contained in:
@@ -170,6 +170,7 @@ RSpec.describe 'Conversations API', type: :request do
|
||||
|
||||
context 'when it is an authenticated user' do
|
||||
let(:agent) { create(:user, account: account, role: :agent) }
|
||||
let(:team) { create(:team, account: account) }
|
||||
|
||||
it 'will not create a new conversation if agent does not have access to inbox' do
|
||||
allow(Rails.configuration.dispatcher).to receive(:dispatch)
|
||||
@@ -250,6 +251,19 @@ RSpec.describe 'Conversations API', type: :request do
|
||||
params: { contact_id: contact.id, inbox_id: inbox.id },
|
||||
as: :json
|
||||
end
|
||||
|
||||
it 'creates a new conversation with assignee and team' do
|
||||
allow(Rails.configuration.dispatcher).to receive(:dispatch)
|
||||
post "/api/v1/accounts/#{account.id}/conversations",
|
||||
headers: agent.create_new_auth_token,
|
||||
params: { source_id: contact_inbox.source_id, contact_id: contact.id, inbox_id: inbox.id, assignee_id: agent.id, team_id: team.id },
|
||||
as: :json
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
response_data = JSON.parse(response.body, symbolize_names: true)
|
||||
expect(response_data[:meta][:assignee][:name]).to eq(agent.name)
|
||||
expect(response_data[:meta][:team][:name]).to eq(team.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user