fix: handle unsupported message update statuses with nil return (#76)
This commit is contained in:
parent
6a5c0b515d
commit
5813628c24
@ -53,8 +53,10 @@ module Whatsapp::BaileysHandlers::MessagesUpdate
|
||||
'read'
|
||||
when 5
|
||||
Rails.logger.warn 'Baileys unsupported message update status: PLAYED(5)'
|
||||
nil
|
||||
else
|
||||
Rails.logger.warn "Baileys unsupported message update status: #{status}"
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -750,9 +750,11 @@ describe Whatsapp::IncomingMessageBaileysService do
|
||||
it 'logs warning for unsupported played status' do
|
||||
update_payload[:update][:status] = 5
|
||||
|
||||
allow(Rails.logger).to receive(:warn).with('Baileys unsupported message update status: PLAYED(5)')
|
||||
allow(Rails.logger).to receive(:warn).with('Baileys unsupported message update status: PLAYED(5)').and_return(true)
|
||||
|
||||
described_class.new(inbox: inbox, params: params).perform
|
||||
expect do
|
||||
described_class.new(inbox: inbox, params: params).perform
|
||||
end.not_to raise_error
|
||||
|
||||
expect(Rails.logger).to have_received(:warn)
|
||||
end
|
||||
@ -760,9 +762,11 @@ describe Whatsapp::IncomingMessageBaileysService do
|
||||
it 'logs warning for unsupported status' do
|
||||
update_payload[:update][:status] = 6
|
||||
|
||||
allow(Rails.logger).to receive(:warn).with('Baileys unsupported message update status: 6')
|
||||
allow(Rails.logger).to receive(:warn).with('Baileys unsupported message update status: 6').and_return(true)
|
||||
|
||||
described_class.new(inbox: inbox, params: params).perform
|
||||
expect do
|
||||
described_class.new(inbox: inbox, params: params).perform
|
||||
end.not_to raise_error
|
||||
|
||||
expect(Rails.logger).to have_received(:warn)
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user