Skip to content

Commit

Permalink
test(LanguageProvider): don't fail on newly added languages (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjkeaton authored Dec 18, 2024
1 parent 0337d1b commit 9e06c8b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/context/language/LanguageProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,28 @@ describe("LanguageProvider", () => {
mockNavigation({ language: "en-US" });

const { container } = render({});
expect(container.textContent).toBe("en-US");
expect(container).toHaveTextContent("en-US");
});

it("es", () => {
mockNavigation({ language: "es-ES" });

const { container } = render({});
expect(container.textContent).toBe("es-ES");
expect(container).toHaveTextContent("es-ES");
});

it("fr", () => {
mockNavigation({ language: "fr-FR" });

const { container } = render({});
expect(container.textContent).toBe("fr-FR");
expect(container).toHaveTextContent("fr-FR");
});

it("zh", () => {
mockNavigation({ language: "zh-CN" });

const { container } = render({});
expect(container.textContent).toBe("zh-CN");
expect(container).toHaveTextContent("zh-CN");
});
});

Expand All @@ -76,11 +76,11 @@ describe("LanguageProvider", () => {
}
});

expect(container.textContent).toBe("en-US");
expect(container).toHaveTextContent("en-US");

await vi.runAllTimersAsync();

expect(container.textContent).toBe("it-IT");
expect(container).toHaveTextContent("it-IT");
});
});

Expand All @@ -97,7 +97,10 @@ describe("LanguageProvider", () => {

await vi.runAllTimersAsync();

expect(availableLocales).toMatchObject([ 'ach-UG', 'en-US', 'es-AR', 'tr-TR' ]);
expect(availableLocales).toContain('ach-UG');
expect(availableLocales).toContain('en-US');
expect(availableLocales).toContain('es-AR');
expect(availableLocales).toContain('tr-TR');
});
});

Expand Down

0 comments on commit 9e06c8b

Please sign in to comment.