Test: 10 more widget components

This commit is contained in:
shamoon
2026-02-02 22:31:17 -08:00
parent 6bdee5bade
commit cd6634e40a
11 changed files with 671 additions and 1 deletions

View File

@@ -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;
},
}),