Ok, make a reusable testing component

This commit is contained in:
shamoon
2026-02-02 22:16:44 -08:00
parent 66136701c2
commit 7192dc2718
7 changed files with 230 additions and 20 deletions

View File

@@ -1 +1,19 @@
import "@testing-library/jest-dom/vitest";
import { cleanup } from "@testing-library/react";
import { afterEach, vi } from "vitest";
afterEach(() => {
cleanup();
});
// implement a couple of common formatters mocked in next-i18next
vi.mock("next-i18next", () => ({
useTranslation: () => ({
t: (key, opts) => {
if (key === "common.number") return String(opts?.value ?? "");
if (key === "common.percent") return String(opts?.value ?? "");
return key;
},
}),
}));