mirror of
https://github.com/zulip/zulip.git
synced 2026-06-30 21:11:04 +08:00
typeahead tests [nfc]: Tighten sort_emojis test data.
This commit is contained in:
parent
66f47791e4
commit
5e109aaa4d
@ -145,48 +145,34 @@ run_test("triage", () => {
|
||||
);
|
||||
});
|
||||
|
||||
run_test("sort_emojis th", () => {
|
||||
const thumbs_up = {
|
||||
emoji_name: "thumbs_up",
|
||||
emoji_code: "1f44d",
|
||||
};
|
||||
const thumbs_down = {
|
||||
emoji_name: "thumbs_down",
|
||||
};
|
||||
const thermometer = {
|
||||
emoji_name: "thermometer",
|
||||
};
|
||||
const mother_nature = {
|
||||
emoji_name: "mother_nature",
|
||||
};
|
||||
function sort_emojis(emojis, query) {
|
||||
return typeahead.sort_emojis(emojis, query).map((emoji) => emoji.emoji_name);
|
||||
}
|
||||
|
||||
const emoji_list = [mother_nature, thermometer, thumbs_down, thumbs_up];
|
||||
|
||||
assert.deepEqual(typeahead.sort_emojis(emoji_list, "th"), [
|
||||
thumbs_up,
|
||||
thermometer,
|
||||
thumbs_down,
|
||||
mother_nature,
|
||||
run_test("sort_emojis: th", () => {
|
||||
const emoji_list = [
|
||||
{emoji_name: "mother_nature"},
|
||||
{emoji_name: "thermometer"},
|
||||
{emoji_name: "thumbs_down"},
|
||||
{emoji_name: "thumbs_up", emoji_code: "1f44d"},
|
||||
];
|
||||
assert.deepEqual(sort_emojis(emoji_list, "th"), [
|
||||
"thumbs_up",
|
||||
"thermometer",
|
||||
"thumbs_down",
|
||||
"mother_nature",
|
||||
]);
|
||||
});
|
||||
|
||||
run_test("sort_emojis sm", () => {
|
||||
const big_smile = {
|
||||
emoji_name: "big_smile",
|
||||
};
|
||||
const slight_smile = {
|
||||
emoji_name: "slight_smile",
|
||||
emoji_code: "1f642",
|
||||
};
|
||||
const small_airplane = {
|
||||
emoji_name: "small_airplane",
|
||||
};
|
||||
|
||||
const emoji_list = [big_smile, slight_smile, small_airplane];
|
||||
|
||||
assert.deepEqual(typeahead.sort_emojis(emoji_list, "sm"), [
|
||||
slight_smile,
|
||||
small_airplane,
|
||||
big_smile,
|
||||
run_test("sort_emojis: sm", () => {
|
||||
const emoji_list = [
|
||||
{emoji_name: "big_smile"},
|
||||
{emoji_name: "slight_smile", emoji_code: "1f642"},
|
||||
{emoji_name: "small_airplane"},
|
||||
];
|
||||
assert.deepEqual(sort_emojis(emoji_list, "sm"), [
|
||||
"slight_smile",
|
||||
"small_airplane",
|
||||
"big_smile",
|
||||
]);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user