|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { render, screen } from "@testing-library/react";
|
|
|
|
|
import { rawRender, screen } from "@/tests";
|
|
|
|
|
import { describe, it } from "vitest";
|
|
|
|
|
import { Language } from ".";
|
|
|
|
|
|
|
|
|
@ -9,13 +9,13 @@ describe("Language text", () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
it("should show short text", () => {
|
|
|
|
|
render(<Language.Text value={testLanguage}></Language.Text>);
|
|
|
|
|
rawRender(<Language.Text value={testLanguage}></Language.Text>);
|
|
|
|
|
|
|
|
|
|
expect(screen.getByText(testLanguage.code2)).toBeDefined();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should show long text", () => {
|
|
|
|
|
render(<Language.Text value={testLanguage} long></Language.Text>);
|
|
|
|
|
rawRender(<Language.Text value={testLanguage} long></Language.Text>);
|
|
|
|
|
|
|
|
|
|
expect(screen.getByText(testLanguage.name)).toBeDefined();
|
|
|
|
|
});
|
|
|
|
@ -23,7 +23,7 @@ describe("Language text", () => {
|
|
|
|
|
const testLanguageWithHi: Language.Info = { ...testLanguage, hi: true };
|
|
|
|
|
|
|
|
|
|
it("should show short text with HI", () => {
|
|
|
|
|
render(<Language.Text value={testLanguageWithHi}></Language.Text>);
|
|
|
|
|
rawRender(<Language.Text value={testLanguageWithHi}></Language.Text>);
|
|
|
|
|
|
|
|
|
|
const expectedText = `${testLanguageWithHi.code2}:HI`;
|
|
|
|
|
|
|
|
|
@ -31,7 +31,7 @@ describe("Language text", () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should show long text with HI", () => {
|
|
|
|
|
render(<Language.Text value={testLanguageWithHi} long></Language.Text>);
|
|
|
|
|
rawRender(<Language.Text value={testLanguageWithHi} long></Language.Text>);
|
|
|
|
|
|
|
|
|
|
const expectedText = `${testLanguageWithHi.name} HI`;
|
|
|
|
|
|
|
|
|
@ -44,7 +44,7 @@ describe("Language text", () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
it("should show short text with Forced", () => {
|
|
|
|
|
render(<Language.Text value={testLanguageWithForced}></Language.Text>);
|
|
|
|
|
rawRender(<Language.Text value={testLanguageWithForced}></Language.Text>);
|
|
|
|
|
|
|
|
|
|
const expectedText = `${testLanguageWithHi.code2}:Forced`;
|
|
|
|
|
|
|
|
|
@ -52,7 +52,9 @@ describe("Language text", () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should show long text with Forced", () => {
|
|
|
|
|
render(<Language.Text value={testLanguageWithForced} long></Language.Text>);
|
|
|
|
|
rawRender(
|
|
|
|
|
<Language.Text value={testLanguageWithForced} long></Language.Text>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const expectedText = `${testLanguageWithHi.name} Forced`;
|
|
|
|
|
|
|
|
|
@ -73,7 +75,7 @@ describe("Language list", () => {
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
it("should show all languages", () => {
|
|
|
|
|
render(<Language.List value={elements}></Language.List>);
|
|
|
|
|
rawRender(<Language.List value={elements}></Language.List>);
|
|
|
|
|
|
|
|
|
|
elements.forEach((value) => {
|
|
|
|
|
expect(screen.getByText(value.name)).toBeDefined();
|
|
|
|
|