iachat/spec/services/whatsapp/zapi_handlers/disconnected_callback_spec.rb
Gabriel Jablonski 8ff5834ee8
fix(zapi): support for LID-only conversations (#123)
* fix: ignore action events

* feat(zapi): allow updating instance ID

* feat: handle `chatLid` field

* test: break down handler specs into separate files

* feat: update send_message method to use recipient_id logic for zapi provider

* fix: use identifier instead of source_id for zapi

* test: fix specs

* feat: prioritize senderName over chatName for contact naming in received callback
2025-10-23 10:12:38 -03:00

20 lines
609 B
Ruby

require 'rails_helper'
describe Whatsapp::ZapiHandlers::DisconnectedCallback do
let!(:whatsapp_channel) do
create(:channel_whatsapp, provider: 'zapi', validate_provider_config: false)
end
let(:inbox) { whatsapp_channel.inbox }
let(:service) { Whatsapp::IncomingMessageZapiService.new(inbox: inbox, params: params) }
describe '#process_disconnected_callback' do
let(:params) { { type: 'DisconnectedCallback' } }
it 'updates provider connection to close' do
service.perform
expect(whatsapp_channel.reload.provider_connection['connection']).to eq('close')
end
end
end