Files
Arkie-Library-Frontend/src/utils/categoryDisplay.test.ts

24 lines
750 B
TypeScript
Raw Normal View History

2026-05-16 18:21:37 +08:00
import { describe, expect, it } from "vitest";
import { categoryCardLines } from "./categoryDisplay";
describe("categoryCardLines", () => {
it("splits Chinese and ASCII parenthetical subtitles", () => {
expect(categoryCardLines("官方公告(繁中)")).toEqual({
line1: "官方公告",
line2: "(繁中)",
});
expect(categoryCardLines("Tutorials (EN)")).toEqual({
line1: "Tutorials",
line2: "(EN)",
});
});
it("uses trimmed description as subtitle when name has no parentheses", () => {
expect(categoryCardLines("影片", " 官方教學 ")).toEqual({
line1: "影片",
line2: "官方教學",
});
expect(categoryCardLines("文件")).toEqual({ line1: "文件" });
});
});