feat: Support for telegram incoming location message (#6158)

Support for incoming location messages in the telegram channel.

ref: #3398
This commit is contained in:
OMAR.A
2023-01-04 12:41:54 +02:00
committed by GitHub
parent c88ea257d5
commit 7b5f1e4876
2 changed files with 34 additions and 0 deletions

View File

@@ -214,5 +214,23 @@ describe Telegram::IncomingMessageService do
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('file')
end
end
context 'when valid location message params' do
it 'creates appropriate conversations, message and contacts' do
params = {
'update_id' => 2_342_342_343_242,
'message' => {
'location': {
'latitude': 37.7893768,
'longitude': -122.3895553
}
}.merge(message_params)
}.with_indifferent_access
described_class.new(inbox: telegram_channel.inbox, params: params).perform
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
expect(Contact.all.first.name).to eq('Sojan Jose')
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('location')
end
end
end
end