Revert "chore: Upgrade Rails to 7.2.2 and update Gemfile dependencies (#11037)"
This reverts commit ef6ba8aabd.
This commit is contained in:
@@ -3,7 +3,6 @@ require 'rails_helper'
|
||||
describe Whatsapp::IncomingMessageWhatsappCloudService do
|
||||
describe '#perform' do
|
||||
let!(:whatsapp_channel) { create(:channel_whatsapp, provider: 'whatsapp_cloud', sync_templates: false, validate_provider_config: false) }
|
||||
let(:sender_number) { '2423423243' }
|
||||
let(:params) do
|
||||
{
|
||||
phone_number: whatsapp_channel.phone_number,
|
||||
@@ -11,9 +10,9 @@ describe Whatsapp::IncomingMessageWhatsappCloudService do
|
||||
entry: [{
|
||||
changes: [{
|
||||
value: {
|
||||
contacts: [{ profile: { name: 'Sojan Jose' }, wa_id: sender_number }],
|
||||
contacts: [{ profile: { name: 'Sojan Jose' }, wa_id: '2423423243' }],
|
||||
messages: [{
|
||||
from: sender_number,
|
||||
from: '2423423243',
|
||||
image: {
|
||||
id: 'b1c68f38-8734-4ad3-b4a1-ef0c10d683',
|
||||
mime_type: 'image/jpeg',
|
||||
@@ -49,7 +48,7 @@ describe Whatsapp::IncomingMessageWhatsappCloudService do
|
||||
|
||||
described_class.new(inbox: whatsapp_channel.inbox, params: params).perform
|
||||
expect(whatsapp_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect_contact_name
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(whatsapp_channel.inbox.messages.first.content).to eq('Check out my product!')
|
||||
expect(whatsapp_channel.inbox.messages.first.attachments.present?).to be false
|
||||
expect(whatsapp_channel.authorization_error_count).to eq(1)
|
||||
@@ -64,9 +63,9 @@ describe Whatsapp::IncomingMessageWhatsappCloudService do
|
||||
entry: [{
|
||||
changes: [{
|
||||
value: {
|
||||
contacts: [{ profile: { name: 'Sojan Jose' }, wa_id: sender_number }],
|
||||
contacts: [{ profile: { name: 'Sojan Jose' }, wa_id: '2423423243' }],
|
||||
messages: [{
|
||||
from: sender_number,
|
||||
from: '2423423243',
|
||||
image: {
|
||||
id: 'b1c68f38-8734-4ad3-b4a1-ef0c10d683',
|
||||
mime_type: 'image/jpeg',
|
||||
@@ -89,7 +88,7 @@ describe Whatsapp::IncomingMessageWhatsappCloudService do
|
||||
it 'with attachment errors' do
|
||||
described_class.new(inbox: whatsapp_channel.inbox, params: error_params).perform
|
||||
expect(whatsapp_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect_contact_name
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(whatsapp_channel.inbox.messages.count).to eq(0)
|
||||
end
|
||||
end
|
||||
@@ -99,7 +98,7 @@ describe Whatsapp::IncomingMessageWhatsappCloudService do
|
||||
described_class.new(inbox: whatsapp_channel.inbox, params: { phone_number: whatsapp_channel.phone_number,
|
||||
object: 'whatsapp_business_account', entry: {} }).perform
|
||||
expect(whatsapp_channel.inbox.conversations.count).to eq(0)
|
||||
expect(Contact.find_by(phone_number: contact_phone_number)).to be_nil
|
||||
expect(Contact.all.first).to be_nil
|
||||
expect(whatsapp_channel.inbox.messages.count).to eq(0)
|
||||
end
|
||||
end
|
||||
@@ -137,7 +136,7 @@ describe Whatsapp::IncomingMessageWhatsappCloudService do
|
||||
end
|
||||
|
||||
def expect_contact_name
|
||||
expect(contact_from_number&.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
end
|
||||
|
||||
def expect_message_content
|
||||
@@ -147,12 +146,4 @@ describe Whatsapp::IncomingMessageWhatsappCloudService do
|
||||
def expect_message_has_attachment
|
||||
expect(whatsapp_channel.inbox.messages.first.attachments.present?).to be true
|
||||
end
|
||||
|
||||
def contact_phone_number
|
||||
"+#{sender_number}"
|
||||
end
|
||||
|
||||
def contact_from_number
|
||||
Contact.find_by(phone_number: contact_phone_number)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user