Move more element-web tests over to vitest (#33845)
* Move more element-web tests over to vitest Switches default env to happy-dom as SdkConfig needs a DOM and is part of the setupTests given a lot of code relies on it * Restore jest variant of editor mock file for tests not yet moved over * Migrate batch of tests tro vitest * Iterate * Migrate another test * Simplify * Iterate * Iterate * Fix lockfile * Deduplicate * Iterate
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
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 withValidation from "../../../../src/components/views/elements/Validation";
|
||||
|
||||
describe("Validation", () => {
|
||||
it("should handle 0 rules", () => {
|
||||
const handler = withValidation({
|
||||
rules: [],
|
||||
});
|
||||
return expect(
|
||||
handler({
|
||||
value: "value",
|
||||
focused: true,
|
||||
}),
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
valid: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
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 }]);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user