test: add frontend test suite
Some checks failed
Deploy to Frontend Servers / deploy (push) Failing after 43s
Some checks failed
Deploy to Frontend Servers / deploy (push) Failing after 43s
This commit is contained in:
23
src/utils/categoryDisplay.test.ts
Normal file
23
src/utils/categoryDisplay.test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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: "文件" });
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user