discourse/plugins/chat/spec/models/chat/null_message_spec.rb
David Battersby 09f2a42f5f
FIX: build chat message excerpt for thread preview (#26765)
Follow up to #26712 to account for older threads that don't have a persisted excerpt, as this was previously generated on every page load.

This change allows us to build the excerpt on the fly when none exists, fixing the issue of missing message excerpts for thread previews (within channel) and thread lists (on mobile/desktop).
2024-04-26 14:29:35 +08:00

30 lines
565 B
Ruby

# frozen_string_literal: true
describe Chat::NullMessage do
subject(:null_message) { described_class.new }
describe "#user" do
it "returns nil" do
expect(null_message.user).to be_nil
end
end
describe "#build_excerpt" do
it "returns nil" do
expect(null_message.build_excerpt).to be_nil
end
end
describe "#id" do
it "returns nil" do
expect(null_message.id).to be_nil
end
end
describe "#create_at" do
it "returns a Time object" do
expect(null_message.created_at).to be_a(Time)
end
end
end