fix: handle unsupported message update statuses with nil return (#76)

This commit is contained in:
Gabriel Jablonski 2025-07-16 09:15:47 -03:00 committed by GitHub
parent 6a5c0b515d
commit 5813628c24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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