fix: Flaky i18n test (#11514)

This commit is contained in:
Tom Moor authored and GitHub committed 2026-02-21 12:35:01 -05:00
1 parent 05381ff101
commit 00ef17b913
1 file changed
+24 -20
+24 -20
View File
@@ -4,12 +4,18 @@ import en_US from "../../shared/i18n/locales/en_US/translation.json";
import pt_PT from "../../shared/i18n/locales/pt_PT/translation.json";
import { initI18n } from "./i18n";
function addResources() {
i18n
.addResources("en-US", "translation", en_US)
.addResources("de-DE", "translation", de_DE)
.addResources("pt-PT", "translation", pt_PT);
}
describe("i18n env is unset", () => {
beforeEach(() => {
initI18n()
.addResources("en-US", "translation", en_US)
.addResources("de-DE", "translation", de_DE)
.addResources("pt-PT", "translation", pt_PT);
beforeEach(async () => {
initI18n();
addResources();
await i18n.changeLanguage("en-US");
});
it("translation of key should match", () =>
@@ -25,12 +31,12 @@ describe("i18n env is unset", () => {
expect(i18n.t("Saving")).toBe("A guardar");
});
});
describe("i18n env is en-US", () => {
beforeEach(() => {
initI18n("en-US")
.addResources("en-US", "translation", en_US)
.addResources("de-DE", "translation", de_DE)
.addResources("pt-PT", "translation", pt_PT);
beforeEach(async () => {
initI18n("en-US");
addResources();
await i18n.changeLanguage("en-US");
});
it("translation of key should match", () =>
@@ -48,11 +54,10 @@ describe("i18n env is en-US", () => {
});
describe("i18n env is de-DE", () => {
beforeEach(() => {
initI18n("de-DE")
.addResources("en-US", "translation", en_US)
.addResources("de-DE", "translation", de_DE)
.addResources("pt-PT", "translation", pt_PT);
beforeEach(async () => {
initI18n("de-DE");
addResources();
await i18n.changeLanguage("de-DE");
});
it("translation of key should match", () =>
@@ -70,11 +75,10 @@ describe("i18n env is de-DE", () => {
});
describe("i18n env is pt-PT", () => {
beforeEach(() => {
initI18n("pt-PT")
.addResources("en-US", "translation", en_US)
.addResources("de-DE", "translation", de_DE)
.addResources("pt-PT", "translation", pt_PT);
beforeEach(async () => {
initI18n("pt-PT");
addResources();
await i18n.changeLanguage("pt-PT");
});
it("translation of key should match", () =>