Chatwoot/spec/jobs/data_import_job_spec.rb
Sojan Jose 615a575bdd
fix: Agent typing indicator for website widget (#4495)
When we migrated the pubsub tokens from contact to contact inboxes, we missed out on doing this update for the typing indicator events. Hence the agent typing events weren't visible on the widget side. This change fixes that and removes the necessary column contact pubsub token from the model.

fixes: #4476
2022-04-18 19:05:45 +05:30

21 lines
689 B
Ruby

require 'rails_helper'
RSpec.describe DataImportJob, type: :job do
subject(:job) { described_class.perform_later(data_import) }
let!(:data_import) { create(:data_import) }
it 'queues the job' do
expect { job }.to have_enqueued_job(described_class)
.with(data_import)
.on_queue('low')
end
it 'imports data into the account' do
csv_length = CSV.parse(data_import.import_file.download, headers: true).length
described_class.perform_now(data_import)
expect(data_import.account.contacts.count).to eq(csv_length)
expect(data_import.reload.total_records).to eq(csv_length)
expect(data_import.reload.processed_records).to eq(csv_length)
end
end