Restructure omni services and add Chatwoot research snapshot

This commit is contained in:
Ruslan Bakiev
2026-02-21 11:11:27 +07:00
parent edea7a0034
commit b73babbbf6
7732 changed files with 978203 additions and 32 deletions

View File

@@ -0,0 +1,32 @@
require 'rails_helper'
describe Labels::UpdateService do
let(:account) { create(:account) }
let(:conversation) { create(:conversation, account: account) }
let(:label) { create(:label, account: account) }
let(:contact) { conversation.contact }
before do
conversation.label_list.add(label.title)
conversation.save!
contact.label_list.add(label.title)
contact.save!
end
describe '#perform' do
it 'updates associated conversations/contacts labels' do
expect(conversation.label_list).to eq([label.title])
expect(contact.label_list).to eq([label.title])
described_class.new(
new_label_title: 'updated-label-title',
old_label_title: label.title,
account_id: account.id
).perform
expect(conversation.reload.label_list).to eq(['updated-label-title'])
expect(contact.reload.label_list).to eq(['updated-label-title'])
end
end
end