Files
discourse/spec/requests/emojis_controller_spec.rb
Joffrey JAFFEUX 80625f6c1c DEV: explicit json for emojis/search-aliases (#31582)
Adds `.json` a suffix everywhere and makes it clear that's it's a json
route.

Also adds a missing spec for this endpoint and updates the underlying
discourse-emojis gem for better symlinking
2025-03-03 15:21:16 +01:00

52 lines
1.1 KiB
Ruby

# frozen_string_literal: true
RSpec.describe EmojisController do
fab!(:user_1) { Fabricate(:user) }
before { sign_in(user_1) }
describe "#index" do
before do
CustomEmoji.destroy_all
CustomEmoji.create!(name: "cat", upload: Fabricate(:upload))
Emoji.clear_cache
end
after do
CustomEmoji.destroy_all
Emoji.clear_cache
end
it "returns the emojis list" do
get "/emojis.json"
expect(response.status).to eq(200)
expect(response.parsed_body.keys).to eq(
%w[
smileys_&_emotion
people_&_body
animals_&_nature
food_&_drink
travel_&_places
activities
objects
symbols
flags
default
],
)
end
end
describe "#search_aliases" do
it "returns the search aliases list" do
get "/emojis/search-aliases.json"
expect(response.status).to eq(200)
expect(response.parsed_body["grinning_face"]).to eq(
%w[cheerful cheery face grin grinning happy laugh nice smile smiling teeth],
)
end
end
end