feat: Shows inbox identifier token for API inbox (#2894)

Fixes: #2605
This commit is contained in:
Brandon Wilson
2021-08-27 10:26:45 -04:00
committed by GitHub
parent 9a8cbee470
commit f94abaef5f
5 changed files with 64 additions and 1 deletions

View File

@@ -87,4 +87,52 @@ RSpec.describe Inbox do
end
end
end
describe '#web_widget?' do
let(:inbox) do
FactoryBot.build(:inbox, channel: channel_val)
end
context 'when the channel type is Channel::WebWidget' do
let(:channel_val) { Channel::WebWidget.new }
it do
expect(inbox.web_widget?).to eq(true)
expect(inbox.inbox_type).to eq('Website')
end
end
context 'when the channel is not Channel::WebWidget' do
let(:channel_val) { Channel::Api.new }
it do
expect(inbox.web_widget?).to eq(false)
expect(inbox.inbox_type).to eq('API')
end
end
end
describe '#api?' do
let(:inbox) do
FactoryBot.build(:inbox, channel: channel_val)
end
context 'when the channel type is Channel::Api' do
let(:channel_val) { Channel::Api.new }
it do
expect(inbox.api?).to eq(true)
expect(inbox.inbox_type).to eq('API')
end
end
context 'when the channel is not Channel::Api' do
let(:channel_val) { Channel::FacebookPage.new }
it do
expect(inbox.api?).to eq(false)
expect(inbox.inbox_type).to eq('Facebook')
end
end
end
end