Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

typeahead tests [nfc]: Simplify writing down test Unicode emoji.

Greg Priceefc26eacecd7
diff --git a/frontend_tests/node_tests/typeahead.js b/frontend_tests/node_tests/typeahead.js
index 90820accd3a..0d34a8153cb 100644
--- a/frontend_tests/node_tests/typeahead.js
+++ b/frontend_tests/node_tests/typeahead.js
@@ -7,18 +7,28 @@ const {run_test} = require("../zjsunit/test");
const typeahead = zrequire("../shared/js/typeahead");
+const unicode_emojis = [
+ ["1f43c", "panda_face"],
+ ["1f642", "smile"],
+];
+
const emojis = [
{emoji_name: "japanese_post_office", url: "TBD"},
- {emoji_name: "panda_face", emoji_code: "1f43c"},
- {emoji_name: "smile", emoji_code: "1f642"},
{emoji_name: "tada", random_field: "whatever"},
+ ...unicode_emojis.map(([emoji_code, emoji_name]) => ({
+ emoji_name,
+ emoji_code,
+ })),
];
run_test("get_emoji_matcher", () => {
function assert_matches(query, expected) {
const matcher = typeahead.get_emoji_matcher(query);
assert.deepEqual(
- emojis.filter((emoji) => matcher(emoji)).map((emoji) => emoji.emoji_name),
+ emojis
+ .filter((emoji) => matcher(emoji))
+ .map((emoji) => emoji.emoji_name)
+ .sort(),
expected,
);
}