|
1 | 1 | import { describe, it, expect } from "vitest"; |
2 | 2 | import raw from "./commands.json"; |
3 | | -import { catalogSchema } from "./schema"; |
| 3 | +import { catalogSchema, type StoredCommandEntry } from "./schema"; |
4 | 4 | import { CATALOG_SECTIONS, ZPL_COMMANDS, catalogEntry, commandId, commandIds, filterCatalog } from "./index"; |
5 | 5 |
|
6 | 6 | describe("zpl command catalog", () => { |
@@ -9,6 +9,12 @@ describe("zpl command catalog", () => { |
9 | 9 | expect(result.success ? [] : result.error.issues).toEqual([]); |
10 | 10 | }); |
11 | 11 |
|
| 12 | + it("stores a docker level only where it diverges from the web", () => { |
| 13 | + for (const c of (raw as unknown as { commands: StoredCommandEntry[] }).commands) { |
| 14 | + if (c.support.docker !== undefined) expect(c.support.docker, c.cmd).not.toBe(c.support.web); |
| 15 | + } |
| 16 | + }); |
| 17 | + |
12 | 18 | it("tracks the whole ZPL II guide: unique ids, grouped by section in section order", () => { |
13 | 19 | // Adding or removing a command is a deliberate act that must move this pin. |
14 | 20 | expect(ZPL_COMMANDS).toHaveLength(225); |
@@ -49,6 +55,7 @@ describe("zpl command catalog", () => { |
49 | 55 | const rank = { no: 0, planned: 1, yes: 2 } as const; |
50 | 56 | for (const c of ZPL_COMMANDS) { |
51 | 57 | expect(rank[c.support.desktop], c.cmd).toBeGreaterThanOrEqual(rank[c.support.web]); |
| 58 | + expect(rank[c.support.docker], c.cmd).toBeGreaterThanOrEqual(rank[c.support.web]); |
52 | 59 | // The coverage legend promises the reason in the name: a qualifier after a comma. |
53 | 60 | if (Object.values(c.support).every((level) => level === "no")) expect(c.title, c.cmd).toMatch(/,/); |
54 | 61 | } |
@@ -61,8 +68,8 @@ describe("zpl command catalog", () => { |
61 | 68 | expect(catalogEntry("~HL")).toBe(catalogEntry("^HL")); |
62 | 69 | expect(commandId(catalogEntry("~HL")!)).toBe("^HL"); |
63 | 70 | // Prefix twins with diverging support are separate entries. |
64 | | - expect(catalogEntry("^PH")?.support).toEqual({ web: "yes", desktop: "yes", lint: "no" }); |
65 | | - expect(catalogEntry("~PH")?.support).toEqual({ web: "no", desktop: "planned", lint: "no" }); |
| 71 | + expect(catalogEntry("^PH")?.support).toEqual({ web: "yes", desktop: "yes", docker: "yes" }); |
| 72 | + expect(catalogEntry("~PH")?.support).toEqual({ web: "no", desktop: "planned", docker: "no" }); |
66 | 73 | expect(catalogEntry("^QQ")).toBeUndefined(); |
67 | 74 | }); |
68 | 75 |
|
|