Fix: skip invalid access token from sentry (#6639)

This commit is contained in:
Tejaswini Chile
2023-03-09 16:28:45 +05:30
committed by GitHub
parent 54b7c98795
commit fbdc79df76
2 changed files with 18 additions and 2 deletions

View File

@@ -52,6 +52,14 @@ describe Facebook::SendOnFacebookService do
expect(bot).to have_received(:deliver)
end
it 'raise and exception to validate access token' do
message = create(:message, message_type: 'outgoing', inbox: facebook_inbox, account: account, conversation: conversation)
allow(bot).to receive(:deliver).and_raise(Facebook::Messenger::FacebookError.new('message' => 'Error validating access token'))
::Facebook::SendOnFacebookService.new(message: message).perform
expect(facebook_channel.authorization_error_count).to eq(1)
end
it 'if message with attachment is sent from chatwoot and is outgoing' do
message = build(:message, message_type: 'outgoing', inbox: facebook_inbox, account: account, conversation: conversation)
attachment = message.attachments.new(account_id: message.account_id, file_type: :image)