chore: Add event for conversations transferred to Bot (#2167)
* chore: Event for conversation transferred to Bot Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Nithin David <webofnithin@gmail.com>
This commit is contained in:
@@ -4,7 +4,6 @@ FactoryBot.define do
|
||||
factory :conversation do
|
||||
status { 'open' }
|
||||
agent_last_seen_at { Time.current }
|
||||
locked { false }
|
||||
identifier { SecureRandom.hex }
|
||||
|
||||
after(:build) do |conversation|
|
||||
|
||||
@@ -93,7 +93,6 @@ RSpec.describe Conversation, type: :model do
|
||||
|
||||
conversation.update(
|
||||
status: :resolved,
|
||||
locked: true,
|
||||
contact_last_seen_at: Time.now,
|
||||
assignee: new_assignee,
|
||||
label_list: [label.title]
|
||||
@@ -106,8 +105,6 @@ RSpec.describe Conversation, type: :model do
|
||||
.with(described_class::CONVERSATION_RESOLVED, kind_of(Time), conversation: conversation)
|
||||
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
|
||||
.with(described_class::CONVERSATION_READ, kind_of(Time), conversation: conversation)
|
||||
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
|
||||
.with(described_class::CONVERSATION_LOCK_TOGGLE, kind_of(Time), conversation: conversation)
|
||||
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
|
||||
.with(described_class::ASSIGNEE_CHANGED, kind_of(Time), conversation: conversation)
|
||||
end
|
||||
@@ -193,28 +190,6 @@ RSpec.describe Conversation, type: :model do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#lock!' do
|
||||
subject(:lock!) { conversation.lock! }
|
||||
|
||||
let(:conversation) { create(:conversation) }
|
||||
|
||||
it 'assigns locks the conversation' do
|
||||
expect(lock!).to eq(true)
|
||||
expect(conversation.reload.locked).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#unlock!' do
|
||||
subject(:unlock!) { conversation.unlock! }
|
||||
|
||||
let(:conversation) { create(:conversation) }
|
||||
|
||||
it 'unlocks the conversation' do
|
||||
expect(unlock!).to eq(true)
|
||||
expect(conversation.reload.locked).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#mute!' do
|
||||
subject(:mute!) { conversation.mute! }
|
||||
|
||||
@@ -365,18 +340,6 @@ RSpec.describe Conversation, type: :model do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#lock_event_data' do
|
||||
subject(:lock_event_data) { conversation.lock_event_data }
|
||||
|
||||
let(:conversation) do
|
||||
build(:conversation, display_id: 505, locked: false)
|
||||
end
|
||||
|
||||
it 'returns lock event payload' do
|
||||
expect(lock_event_data).to eq(id: 505, locked: false)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#botinbox: when conversation created inside inbox with agent bot' do
|
||||
let!(:bot_inbox) { create(:agent_bot_inbox) }
|
||||
let(:conversation) { create(:conversation, inbox: bot_inbox.inbox) }
|
||||
|
||||
@@ -6,10 +6,6 @@ RSpec.describe Conversations::EventDataPresenter do
|
||||
let(:presenter) { described_class.new(conversation) }
|
||||
let(:conversation) { create(:conversation) }
|
||||
|
||||
describe '#lock_data' do
|
||||
it { expect(presenter.lock_data).to eq(id: conversation.display_id, locked: false) }
|
||||
end
|
||||
|
||||
describe '#push_data' do
|
||||
let(:expected_data) do
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user