2023-06-16 14:37:16 -03:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.describe AiChatChannelSerializer do
|
2024-03-05 16:48:28 +01:00
|
|
|
fab!(:admin)
|
2023-06-16 14:37:16 -03:00
|
|
|
|
|
|
|
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 16:26:43 +10:00
|
|
|
serialized = described_class.new(dm_channel, scope: Guardian.new(admin), root: nil)
|
2023-06-16 14:37:16 -03: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 16:26:43 +10:00
|
|
|
serialized = described_class.new(channel, scope: Guardian.new(admin), root: nil)
|
2023-06-16 14:37:16 -03:00
|
|
|
|
|
|
|
expect(serialized.title).to eq(channel.title)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|