Initial commit: Add logistics and order_detail message types
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
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>
This commit is contained in:
76
spec/jobs/delete_object_job_spec.rb
Normal file
76
spec/jobs/delete_object_job_spec.rb
Normal file
@@ -0,0 +1,76 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DeleteObjectJob, type: :job do
|
||||
describe '#perform' do
|
||||
context 'when object is heavy (Inbox)' do
|
||||
let!(:account) { create(:account) }
|
||||
let!(:inbox) { create(:inbox, account: account) }
|
||||
|
||||
before do
|
||||
create_list(:conversation, 3, account: account, inbox: inbox)
|
||||
ReportingEvent.create!(account: account, inbox: inbox, name: 'inbox_metric', value: 1.0)
|
||||
end
|
||||
|
||||
it 'enqueues on the low queue' do
|
||||
expect { described_class.perform_later(inbox) }
|
||||
.to have_enqueued_job(described_class).with(inbox).on_queue('low')
|
||||
end
|
||||
|
||||
it 'pre-deletes heavy associations and then destroys the object' do
|
||||
conv_ids = inbox.conversations.pluck(:id)
|
||||
ci_ids = inbox.contact_inboxes.pluck(:id)
|
||||
contact_ids = inbox.contacts.pluck(:id)
|
||||
re_ids = inbox.reporting_events.pluck(:id)
|
||||
|
||||
described_class.perform_now(inbox)
|
||||
|
||||
# Reload associations to ensure database state is current
|
||||
expect(Conversation.where(id: conv_ids).reload).to be_empty
|
||||
expect(ContactInbox.where(id: ci_ids).reload).to be_empty
|
||||
expect(ReportingEvent.where(id: re_ids).reload).to be_empty
|
||||
# Contacts should not be deleted for inbox destroy
|
||||
expect(Contact.where(id: contact_ids).reload).not_to be_empty
|
||||
expect { inbox.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when object is heavy (Account)' do
|
||||
let!(:account) { create(:account) }
|
||||
let!(:inbox1) { create(:inbox, account: account) }
|
||||
let!(:inbox2) { create(:inbox, account: account) }
|
||||
|
||||
before do
|
||||
create_list(:conversation, 2, account: account, inbox: inbox1)
|
||||
create_list(:conversation, 1, account: account, inbox: inbox2)
|
||||
ReportingEvent.create!(account: account, name: 'acct_metric', value: 2.5)
|
||||
ReportingEvent.create!(account: account, inbox: inbox1, name: 'acct_inbox_metric', value: 3.5)
|
||||
end
|
||||
|
||||
it 'pre-deletes conversations, contacts, inboxes and reporting events and then destroys the account' do
|
||||
conv_ids = account.conversations.pluck(:id)
|
||||
contact_ids = account.contacts.pluck(:id)
|
||||
inbox_ids = account.inboxes.pluck(:id)
|
||||
re_ids = account.reporting_events.pluck(:id)
|
||||
|
||||
described_class.perform_now(account)
|
||||
|
||||
# Reload associations to ensure database state is current
|
||||
expect(Conversation.where(id: conv_ids).reload).to be_empty
|
||||
expect(Contact.where(id: contact_ids).reload).to be_empty
|
||||
expect(Inbox.where(id: inbox_ids).reload).to be_empty
|
||||
expect(ReportingEvent.where(id: re_ids).reload).to be_empty
|
||||
expect { account.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when object is regular (Label)' do
|
||||
it 'just destroys the object' do
|
||||
label = create(:label)
|
||||
|
||||
described_class.perform_now(label)
|
||||
|
||||
expect { label.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user