iachat/spec/jobs/channels/whatsapp/baileys_connection_check_job_spec.rb
Gabriel Jablonski 2cf1795a3b
feat: baileys connection period check (#87)
* feat: periodic check for baileys connection

* chore: add index on provider connection
2025-07-26 11:38:16 -03:00

21 lines
654 B
Ruby

require 'rails_helper'
RSpec.describe Channels::Whatsapp::BaileysConnectionCheckJob do
let(:channel_whatsapp) { create(:channel_whatsapp, sync_templates: false, validate_provider_config: false) }
it 'enqueues the job' do
expect { described_class.perform_later(channel_whatsapp) }.to have_enqueued_job(described_class)
.on_queue('low')
end
context 'when called' do
it 'calls setup_channel_provider' do
allow(channel_whatsapp).to receive(:setup_channel_provider).and_return(true)
described_class.perform_now(channel_whatsapp)
expect(channel_whatsapp).to have_received(:setup_channel_provider)
end
end
end