2023-06-16 13:37:16 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.describe AiChatChannelSerializer do
|
|
|
|
fab!(:admin) { Fabricate(:admin) }
|
|
|
|
|
|
|
|
describe "#title" do
|
|
|
|
context "when the channel is a DM" do
|
|
|
|
fab!(:dm_channel) { Fabricate(:direct_message_channel) }
|
|
|
|
|
|
|
|
it "display every participant" do
|
2023-12-06 01:26:43 -05:00
|
|
|
serialized = described_class.new(dm_channel, scope: Guardian.new(admin), root: nil)
|
2023-06-16 13:37:16 -04:00
|
|
|
|
|
|
|
expect(serialized.title).to eq(dm_channel.title(nil))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when the channel is a regular one" do
|
|
|
|
fab!(:channel) { Fabricate(:chat_channel) }
|
|
|
|
|
|
|
|
it "displays the category title" do
|
2023-12-06 01:26:43 -05:00
|
|
|
serialized = described_class.new(channel, scope: Guardian.new(admin), root: nil)
|
2023-06-16 13:37:16 -04:00
|
|
|
|
|
|
|
expect(serialized.title).to eq(channel.title)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|