mirror of
https://github.com/gethomepage/homepage.git
synced 2026-02-08 00:40:52 +08:00
Test: 10 more widget components
This commit is contained in:
@@ -4,7 +4,8 @@ import { cleanup } from "@testing-library/react";
|
||||
import { afterEach, vi } from "vitest";
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
// Node-environment tests shouldn't require jsdom; guard cleanup accordingly.
|
||||
if (typeof document !== "undefined") cleanup();
|
||||
});
|
||||
|
||||
// implement a couple of common formatters mocked in next-i18next
|
||||
@@ -13,6 +14,10 @@ vi.mock("next-i18next", () => ({
|
||||
t: (key, opts) => {
|
||||
if (key === "common.number") return String(opts?.value ?? "");
|
||||
if (key === "common.percent") return String(opts?.value ?? "");
|
||||
if (key === "common.bytes") return String(opts?.value ?? "");
|
||||
if (key === "common.bbytes") return String(opts?.value ?? "");
|
||||
if (key === "common.byterate") return String(opts?.value ?? "");
|
||||
if (key === "common.duration") return String(opts?.value ?? "");
|
||||
return key;
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user