返回 CodeWhale
plugins.test.ts
根目录 / web / lib / content / plugins.test.ts
1 import { describe, expect, it } from "vitest";
2 import { PLUGINS_COMING, PLUGINS_COMING_VERSION, pluginsComingApplies } from "./plugins";
3
4 describe("plugins page, what 0.10.3 adds", () => {
5 it("shows the coming section only while the published release is older than 0.10.3", () => {
6 expect(PLUGINS_COMING_VERSION).toBe("0.10.3");
7 expect(pluginsComingApplies(null)).toBe(true);
8 expect(pluginsComingApplies({ version: "0.10.2" })).toBe(true);
9 expect(pluginsComingApplies({ version: "0.10.3" })).toBe(false);
10 expect(pluginsComingApplies({ version: "0.11.0" })).toBe(false);
11 });
12
13 it("carries English and Chinese for every item", () => {
14 for (const item of PLUGINS_COMING) {
15 for (const text of [item.title, item.detail]) {
16 expect(text.en.trim().length).toBeGreaterThan(0);
17 expect(text.zh.trim().length).toBeGreaterThan(0);
18 expect(text.zh).not.toBe(text.en);
19 }
20 }
21 });
22 });
23
23 lines TYPESCRIPT