mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 22:32:04 +00:00
test: prime only the EN catalog in the unit setup
The setup file runs once per test file and imported all eight message catalogs, several hundred kilobytes each, which made setup the largest share of a component-suite run. It now primes EN, the fallback floor of the t() chain. A test that renders another locale primes it at module scope through primeLocales(), which loads the catalog via the production loader in a file-level beforeAll.
This commit is contained in:
1 parent
5cfd129b02
commit
9b93247ae0
91 files changed
+307
-21
No files matched your search
@@ -27,6 +27,9 @@ import {
|
||||
visibleRestoreJobs,
|
||||
} from "@/components/admin/backup-restore-status";
|
||||
import type { BackupRestoreJobView } from "@/lib/jobs/backup-restore";
|
||||
import { primeLocales } from "@/__tests__/helpers/prime-locales";
|
||||
|
||||
primeLocales("de");
|
||||
|
||||
vi.mock("next/navigation", () => ({
|
||||
useRouter: () => ({ push: vi.fn(), replace: vi.fn() }),
|
||||
|
||||
@@ -31,6 +31,9 @@ import {
|
||||
missingSectionsOf,
|
||||
} from "@/components/admin/backups-section";
|
||||
import type { MissingBackupSection } from "@/lib/export/restore-skips";
|
||||
import { primeLocales } from "@/__tests__/helpers/prime-locales";
|
||||
|
||||
primeLocales("de");
|
||||
|
||||
vi.mock("next/navigation", () => ({
|
||||
useRouter: () => ({ push: vi.fn(), replace: vi.fn() }),
|
||||
|
||||
@@ -24,6 +24,9 @@ import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { I18nProvider } from "@/lib/i18n/context";
|
||||
import { RestoreSkipReport } from "@/components/admin/backups-section";
|
||||
import type { RestoreSkipSummary } from "@/lib/export/restore-skips";
|
||||
import { primeLocales } from "@/__tests__/helpers/prime-locales";
|
||||
|
||||
primeLocales("de");
|
||||
|
||||
vi.mock("next/navigation", () => ({
|
||||
useRouter: () => ({ push: vi.fn(), replace: vi.fn() }),
|
||||
|
||||
@@ -83,6 +83,9 @@ vi.mock("@/hooks/use-auth", () => ({
|
||||
|
||||
import { I18nProvider } from "@/lib/i18n/context";
|
||||
import { BackupsSection } from "../backups-section";
|
||||
import { primeLocales } from "@/__tests__/helpers/prime-locales";
|
||||
|
||||
primeLocales("de");
|
||||
|
||||
function render(locale: "en" | "de" = "en") {
|
||||
mocks.queryData = {
|
||||
|
||||
@@ -21,6 +21,9 @@ import {
|
||||
clampMaxUses,
|
||||
} from "@/components/admin/invite-tokens-section";
|
||||
import { queryKeys } from "@/lib/query-keys";
|
||||
import { primeLocales } from "@/__tests__/helpers/prime-locales";
|
||||
|
||||
primeLocales("de");
|
||||
|
||||
const FUTURE = new Date(Date.now() + 7 * 86_400_000).toISOString();
|
||||
const PAST = new Date(Date.now() - 86_400_000).toISOString();
|
||||
|
||||
@@ -19,6 +19,9 @@ import { queryKeys } from "@/lib/query-keys";
|
||||
import { KeyBackupCard } from "@/components/admin/key-backup-card";
|
||||
import { KeyBackupBanner } from "@/components/dashboard/key-backup-banner";
|
||||
import type { KeyBackupStatus } from "@/components/admin/use-key-backup-status";
|
||||
import { primeLocales } from "@/__tests__/helpers/prime-locales";
|
||||
|
||||
primeLocales("de");
|
||||
|
||||
vi.mock("next/navigation", () => ({
|
||||
useRouter: () => ({ push: vi.fn(), replace: vi.fn() }),
|
||||
|
||||
@@ -16,6 +16,9 @@ import { PulseDayMeanCard } from "@/components/admin/pulse-day-mean-card";
|
||||
import { I18nProvider } from "@/lib/i18n/context";
|
||||
import { queryKeys } from "@/lib/query-keys";
|
||||
import type { PulseDayMeanStatus } from "@/lib/validations/pulse-day-mean";
|
||||
import { primeLocales } from "@/__tests__/helpers/prime-locales";
|
||||
|
||||
primeLocales("de");
|
||||
|
||||
const RESULT = {
|
||||
accounts: 2,
|
||||
|
||||
Reference in new issue
Block a user