import { readFile } from "node:fs/promises"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; const bundledThemeNames = { "typora-github": "Typora Github", "typora-pixyll": "Typora Pixyll", "typora-whitey": "Typora whitey", "typora-like": "Typora Clean" } as const; describe("内置主题清单", () => { it("使用稳定主题 ID 和面向用户的显示名称", async () => { const themesRoot = fileURLToPath( new URL("../../../themes/", import.meta.url) ); for (const [id, name] of Object.entries(bundledThemeNames)) { const manifest = JSON.parse( await readFile( `${themesRoot}${id}/theme.json`, "utf8" ) ) as { id?: unknown; name?: unknown }; expect(manifest.id).toBe(id); expect(manifest.name).toBe(name); } }); });