Files
ThreadNet-Web/apps/web/test/unit-tests/components/views/emojipicker/recent-test.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.4 KiB
TypeScript
Raw Normal View History

/*
Copyright 2026 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { translateLegacyEmojiData, mergeEmojiData } from "../../../../../src/emojipicker/recent.ts";
describe("recent", () => {
describe("translateLegacyEmojiData", () => {
it("should correctly translate to the new format", () => {
expect(
translateLegacyEmojiData([
["🤩", 1],
["😀", 2],
]),
).toEqual([
{ emoji: "🤩", total: 1 },
{ emoji: "😀", total: 2 },
]);
});
});
describe("mergeEmojiData", () => {
it("should merge given data correctly", () => {
expect(
mergeEmojiData(
[{ emoji: "🤩", total: 1 }],
[
{ emoji: "🤩", total: 2 },
{ emoji: "😀", total: 1 },
],
),
).toEqual([
{ emoji: "🤩", total: 2 },
{ emoji: "😀", total: 1 },
]);
});
it("should handle data2 being undefined", () => {
expect(mergeEmojiData([{ emoji: "🤩", total: 1 }])).toEqual([{ emoji: "🤩", total: 1 }]);
});
});
});