feat: Slack link unfurling (#7940)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
@@ -3,6 +3,7 @@ require 'rails_helper'
|
||||
describe Integrations::Slack::IncomingMessageBuilder do
|
||||
let(:account) { create(:account) }
|
||||
let(:message_params) { slack_message_stub }
|
||||
let(:builder) { described_class.new(hook: hook) }
|
||||
let(:private_message_params) do
|
||||
{
|
||||
team_id: 'TLST3048H',
|
||||
@@ -30,6 +31,8 @@ describe Integrations::Slack::IncomingMessageBuilder do
|
||||
event_time: 1_588_623_033
|
||||
}
|
||||
end
|
||||
let(:slack_client) { double }
|
||||
let(:link_unfurl_service) { double }
|
||||
let(:message_with_attachments) { slack_attachment_stub }
|
||||
let(:message_without_thread_ts) { slack_message_stub_without_thread_ts }
|
||||
let(:verification_params) { slack_url_verification_stub }
|
||||
@@ -145,5 +148,24 @@ describe Integrations::Slack::IncomingMessageBuilder do
|
||||
expect(conversation.messages.count).to eql(messages_count)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when link shared' do
|
||||
let(:link_shared) do
|
||||
{
|
||||
team_id: 'TLST3048H',
|
||||
api_app_id: 'A012S5UETV4',
|
||||
event: link_shared_event.merge({ links: [{ url: "https://qa.chatwoot.com/app/accounts/1/conversations/#{conversation.display_id}",
|
||||
domain: 'qa.chatwoot.com' }] }),
|
||||
type: 'event_callback',
|
||||
event_time: 1_588_623_033
|
||||
}
|
||||
end
|
||||
|
||||
it 'unfurls link' do
|
||||
builder = described_class.new(link_shared)
|
||||
expect(SlackUnfurlJob).to receive(:perform_later).with(link_shared, hook)
|
||||
builder.perform
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user