mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
DEV: Use serializers for user_notification_schedule
and featured_topic
(#27719)
Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
This commit is contained in:
@ -352,4 +352,25 @@ RSpec.describe CurrentUserSerializer do
|
||||
expect(initial_count).to eq(final_count)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#featured_topic" do
|
||||
fab!(:featured_topic) { Fabricate(:topic) }
|
||||
|
||||
before { user.user_profile.update!(featured_topic_id: featured_topic.id) }
|
||||
|
||||
it "includes the featured topic" do
|
||||
payload = serializer.as_json
|
||||
|
||||
expect(payload[:featured_topic]).to_not be_nil
|
||||
expect(payload[:featured_topic][:id]).to eq(featured_topic.id)
|
||||
expect(payload[:featured_topic][:title]).to eq(featured_topic.title)
|
||||
expect(payload[:featured_topic].keys).to contain_exactly(
|
||||
:id,
|
||||
:title,
|
||||
:fancy_title,
|
||||
:slug,
|
||||
:posts_count,
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user