1
0
forked from baron/baron-sso

slug 명칭 한글 수정

This commit is contained in:
2026-02-25 14:17:45 +09:00
parent bc07619452
commit 600961f33d
10 changed files with 406 additions and 15 deletions

View File

@@ -0,0 +1,33 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { t } from "./i18n";
describe("i18n utility", () => {
beforeEach(() => {
window.localStorage.clear();
vi.clearAllMocks();
});
it("returns fallback if key not found", () => {
expect(t("non.existent.key", "Fallback")).toBe("Fallback");
});
it("returns key if fallback not provided and key not found", () => {
expect(t("non.existent.key")).toBe("non.existent.key");
});
it("replaces variables in template", () => {
expect(t("test.key", "Hello {{ name }}", { name: "World" })).toBe("Hello World");
});
it("respects locale in localStorage", () => {
window.localStorage.setItem("locale", "en");
// We expect some key that exists in en.toml
// Let's use a common one or a fallback if we don't know the content
expect(t("ui.common.save", "Save")).toBe("Save");
});
it("defaults to ko if no locale set and browser language is ko", () => {
vi.spyOn(window.navigator, 'language', 'get').mockReturnValue('ko-KR');
expect(t("ui.common.save", "저장")).toBe("저장");
});
});

View File

@@ -0,0 +1,13 @@
import { describe, expect, it } from "vitest";
import { cn } from "./utils";
describe("cn utility", () => {
it("merges class names correctly", () => {
expect(cn("a", "b")).toBe("a b");
expect(cn("a", { b: true, c: false })).toBe("a b");
});
it("handles tailwind class conflicts", () => {
expect(cn("px-2 py-2", "px-4")).toBe("py-2 px-4");
});
});