Feat/5733 Add private note action in macros (#5805)

This commit is contained in:
Tejaswini Chile
2022-11-07 22:12:10 +05:30
committed by GitHub
parent 894234e777
commit a23974d8b9
5 changed files with 33 additions and 2 deletions

View File

@@ -234,7 +234,8 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
{ 'action_name' => 'add_label', 'action_params' => %w[support priority_customer] },
{ 'action_name' => 'snooze_conversation' },
{ 'action_name' => 'assign_best_agent', 'action_params' => [user_1.id] },
{ 'action_name' => 'send_message', 'action_params' => ['Send this message.'] }
{ 'action_name' => 'send_message', 'action_params' => ['Send this message.'] },
{ 'action_name' => 'add_private_note', 'action_params': ['We are sending greeting message to customer.'] }
])
end
@@ -296,6 +297,20 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
expect(conversation.reload.status).to eql('snoozed')
end
it 'Adds the private note' do
expect(conversation.messages).to be_empty
perform_enqueued_jobs do
post "/api/v1/accounts/#{account.id}/macros/#{macro.id}/execute",
params: { conversation_ids: [conversation.display_id] },
headers: administrator.create_new_auth_token
end
expect(conversation.messages.last.content).to eq('We are sending greeting message to customer.')
expect(conversation.messages.last.sender).to eq(administrator)
expect(conversation.messages.last.private).to be_truthy
end
end
end
end