返回 DeepSeek-Reasonix
skills-layout-contract.test.mjs
根目录 / site / src / scripts / skills-layout-contract.test.mjs
1 import assert from "node:assert/strict";
2 import { readFile } from "node:fs/promises";
3 import test from "node:test";
4
5 const source = () => readFile(new URL("../pages/skills.astro", import.meta.url), "utf8");
6
7 test("the registry publish CTA does not inherit the publish panel layout", async () => {
8 const page = await source();
9
10 assert.match(page, /class="btn btn-dark reg-publish-cta" id="publish-open"/);
11 assert.match(page, /<section class="reg-publish" id="publish" hidden>/);
12 assert.doesNotMatch(page, /class="btn btn-dark reg-publish" id="publish-open"/);
13 });
14
15 test("the registry exposes plugins as a first-class package kind", async () => {
16 const page = await source();
17
18 assert.match(page, /<button data-kind="plugin" role="tab">Plugins<\/button>/);
19 assert.match(page, /<option value="plugin">plugin<\/option>/);
20 assert.match(page, /installKind: f\.get\('kind'\)/);
21 assert.match(page, /Plugins must point to a GitHub repository or path containing/);
22 assert.match(page, /reasonix-plugin\.json/);
23 assert.match(page, /\.codex-plugin\/plugin\.json/);
24 assert.match(page, /\.claude-plugin\/plugin\.json/);
25 assert.match(page, /\.claude-plugin\/marketplace\.json/);
26 assert.match(page, /pattern="\(https\?:\/\/\[\^ \]\+\|git:github\[\.\]com\/\[\^ \]\+/);
27 });
28
29 test("registry copy requests preserve the reviewed package kind", async () => {
30 const page = await source();
31
32 assert.match(page, /Install this Reasonix \$\{p\.kind\} package from \$\{p\.source\}/);
33 assert.match(page, /Use install_source with kind="\$\{p\.kind\}"/);
34 assert.match(page, /data-copy="\$\{esc\(installRequest\(p\)\)\}"/);
35 assert.doesNotMatch(page, /data-copy="\$\{esc\(p\.source\)\}"/);
36 });
37
38 test("admin approval is bound to the package revision shown in the review queue", async () => {
39 const page = await source();
40
41 assert.match(page, /data-version="\$\{esc\(p\.latestVersion\)\}"/);
42 assert.match(page, /data-updated-at="\$\{esc\(p\.updatedAt\)\}"/);
43 assert.match(page, /data-status="\$\{esc\(p\.status\)\}"/);
44 assert.match(page, /expectedVersion: row\.dataset\.version/);
45 assert.match(page, /expectedUpdatedAt: row\.dataset\.updatedAt/);
46 assert.match(page, /expectedStatus: row\.dataset\.status/);
47 assert.match(page, /if \(r\.status === 409\) loadReview\(\)/);
48 });
49
49 lines Plain Text