test(web): reset i18n to English after the language-switch test

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 22:47:27 +02:00
parent 478b4ce44e
commit 2e4187c850
+7 -1
View File
@@ -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();