mirror of
https://github.com/gethomepage/homepage.git
synced 2026-02-07 16:30:52 +08:00
Ok, make a reusable testing component
This commit is contained in:
@@ -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;
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user