fix: Error when unsupported Whatsapp message status (#6295)

fixes error when unsupported WhatsApp message status
This commit is contained in:
Sojan Jose
2023-01-19 18:52:38 +05:30
committed by GitHub
parent 1193cf1847
commit e2ccac78d2
3 changed files with 30 additions and 14 deletions

View File

@@ -113,6 +113,17 @@ describe Whatsapp::IncomingMessageService do
expect(message.reload.status).to eq('failed')
expect(message.external_error).to eq('123: abc')
end
it 'will not throw error if unsupported status' do
status_params = {
'statuses' => [{ 'recipient_id' => from, 'id' => from, 'status' => 'deleted',
'errors' => [{ 'code': 123, 'title': 'abc' }] }]
}.with_indifferent_access
message = Message.find_by!(source_id: from)
expect(message.status).to eq('sent')
expect { described_class.new(inbox: whatsapp_channel.inbox, params: status_params).perform }.not_to raise_error
end
end
context 'when valid interactive message params' do