Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
96 lines
3.2 KiB
Ruby
96 lines
3.2 KiB
Ruby
require 'rails_helper'
|
|
|
|
describe ActionService do
|
|
let(:account) { create(:account) }
|
|
|
|
describe '#resolve_conversation' do
|
|
let(:conversation) { create(:conversation) }
|
|
let(:action_service) { described_class.new(conversation) }
|
|
|
|
it 'resolves the conversation' do
|
|
expect(conversation.status).to eq('open')
|
|
action_service.resolve_conversation(nil)
|
|
expect(conversation.reload.status).to eq('resolved')
|
|
end
|
|
end
|
|
|
|
describe '#open_conversation' do
|
|
let(:conversation) { create(:conversation, status: :resolved) }
|
|
let(:action_service) { described_class.new(conversation) }
|
|
|
|
it 'opens the conversation' do
|
|
expect(conversation.status).to eq('resolved')
|
|
action_service.open_conversation(nil)
|
|
expect(conversation.reload.status).to eq('open')
|
|
end
|
|
end
|
|
|
|
describe '#change_priority' do
|
|
let(:conversation) { create(:conversation) }
|
|
let(:action_service) { described_class.new(conversation) }
|
|
|
|
it 'changes the priority of the conversation to medium' do
|
|
action_service.change_priority(['medium'])
|
|
expect(conversation.reload.priority).to eq('medium')
|
|
end
|
|
|
|
it 'changes the priority of the conversation to nil' do
|
|
action_service.change_priority(['nil'])
|
|
expect(conversation.reload.priority).to be_nil
|
|
end
|
|
end
|
|
|
|
describe '#assign_agent' do
|
|
let(:agent) { create(:user, account: account, role: :agent) }
|
|
let(:inbox_member) { create(:inbox_member, inbox: conversation.inbox, user: agent) }
|
|
let(:conversation) { create(:conversation, :with_assignee, account: account) }
|
|
let(:action_service) { described_class.new(conversation) }
|
|
|
|
it 'unassigns the conversation if agent id is nil' do
|
|
action_service.assign_agent(['nil'])
|
|
expect(conversation.reload.assignee).to be_nil
|
|
end
|
|
end
|
|
|
|
describe '#assign_team' do
|
|
let(:agent) { create(:user, account: account, role: :agent) }
|
|
let(:inbox_member) { create(:inbox_member, inbox: conversation.inbox, user: agent) }
|
|
let(:team) { create(:team, name: 'ConversationTeam', account: account) }
|
|
let(:conversation) { create(:conversation, :with_team, account: account) }
|
|
let(:action_service) { described_class.new(conversation) }
|
|
|
|
context 'when team_id is not present' do
|
|
it 'unassign the if team_id is "nil"' do
|
|
expect do
|
|
action_service.assign_team(['nil'])
|
|
end.not_to raise_error
|
|
expect(conversation.reload.team).to be_nil
|
|
end
|
|
|
|
it 'unassign the if team_id is 0' do
|
|
expect do
|
|
action_service.assign_team([0])
|
|
end.not_to raise_error
|
|
expect(conversation.reload.team).to be_nil
|
|
end
|
|
end
|
|
|
|
context 'when team_id is present' do
|
|
it 'assign the team if the team is part of the account' do
|
|
original_team = conversation.team
|
|
expect do
|
|
action_service.assign_team([team.id])
|
|
end.to change { conversation.reload.team }.from(original_team)
|
|
end
|
|
|
|
it 'does not assign the team if the team is part of the account' do
|
|
original_team = conversation.team
|
|
invalid_team_id = 999_999_999
|
|
expect do
|
|
action_service.assign_team([invalid_team_id])
|
|
end.not_to change { conversation.reload.team }.from(original_team)
|
|
end
|
|
end
|
|
end
|
|
end
|