33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { LOCALES, MESSAGES, translate } from "@/lib/i18n/messages";
|
|
import { CINEMA_CATEGORIES } from "@/lib/cinemas";
|
|
|
|
describe("i18n messages", () => {
|
|
it("มีข้อความครบทุก locale", () => {
|
|
for (const locale of LOCALES) {
|
|
const messages = MESSAGES[locale];
|
|
expect(messages.hero.titleSuffix.length).toBeGreaterThan(0);
|
|
expect(messages.list.title.length).toBeGreaterThan(0);
|
|
expect(messages.detail.otherCinemas.length).toBeGreaterThan(0);
|
|
}
|
|
});
|
|
|
|
it("แปลป้ายได้ครบทุกหมวดหมู่ที่ใช้กรอง", () => {
|
|
for (const locale of LOCALES) {
|
|
for (const category of CINEMA_CATEGORIES) {
|
|
expect(MESSAGES[locale].categories[category]).toBeTruthy();
|
|
}
|
|
}
|
|
});
|
|
|
|
it("ภาษาอังกฤษต่างจากไทยในข้อความหลัก", () => {
|
|
expect(MESSAGES.en.list.title).not.toBe(MESSAGES.th.list.title);
|
|
expect(MESSAGES.en.search.submit).not.toBe(MESSAGES.th.search.submit);
|
|
});
|
|
|
|
it("ค่าที่ไม่รู้จักถูกส่งกลับตามเดิม", () => {
|
|
expect(translate(MESSAGES.en.tags, "tag-ใหม่")).toBe("tag-ใหม่");
|
|
});
|
|
});
|