From 2e4187c850614cb085505fc1d9efb434aba22158 Mon Sep 17 00:00:00 2001 From: Anders Olsson Date: Wed, 3 Jun 2026 22:47:27 +0200 Subject: [PATCH] test(web): reset i18n to English after the language-switch test Co-Authored-By: Claude Opus 4.8 (1M context) --- web/src/i18n/i18n.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/src/i18n/i18n.test.tsx b/web/src/i18n/i18n.test.tsx index f58bffd..30f6646 100644 --- a/web/src/i18n/i18n.test.tsx +++ b/web/src/i18n/i18n.test.tsx @@ -1,4 +1,4 @@ -import { expect, test, beforeEach } from "vitest"; +import { expect, test, beforeEach, afterEach } from "vitest"; import { render, screen, act } from "@testing-library/react"; import { useTranslation } from "react-i18next"; import i18n from "./index"; @@ -8,6 +8,12 @@ beforeEach(async () => { await i18n.changeLanguage("en"); }); +// Leave the shared i18n singleton on English so language-dependent assertions in +// other test files are never affected by this file's runtime switch to Swedish. +afterEach(async () => { + await i18n.changeLanguage("en"); +}); + function Probe() { const { t } = useTranslation(); const { setLocale } = useLocale();