| 1 | import assert from "node:assert/strict"; |
| 2 | import { readFile } from "node:fs/promises"; |
| 3 | import test from "node:test"; |
| 4 | |
| 5 | const source = (path) => readFile(new URL(path, import.meta.url), "utf8"); |
| 6 | |
| 7 | test("homepage presents one VS Code extension through both registries", async () => { |
| 8 | const page = await source("../pages/index.astro"); |
| 9 | |
| 10 | assert.match(page, /data-pane="vscode"/); |
| 11 | assert.match(page, /data-pane="desktop"[\s\S]*data-pane="npm"[\s\S]*data-pane="brew"[\s\S]*data-pane="vscode"/); |
| 12 | assert.match(page, /Editor extension[\s\S]*编辑器扩展/); |
| 13 | assert.match(page, /More ways to use Reasonix:[\s\S]*更多使用方式:/); |
| 14 | assert.match(page, /Local Web UI:[\s\S]*reasonix serve[\s\S]*本地 Web UI:/); |
| 15 | assert.match(page, /ACP editor integration[\s\S]*ACP 编辑器接入/); |
| 16 | assert.match(page, /SivanLiu\.reasonix-agent/); |
| 17 | assert.match(page, /marketplace\.visualstudio\.com\/items\?itemName=SivanLiu\.reasonix-agent/); |
| 18 | assert.match(page, /open-vsx\.org\/extension\/SivanLiu\/reasonix-agent/); |
| 19 | assert.match(page, /does not bundle the CLI/); |
| 20 | assert.match(page, /data-goto="vscode"/); |
| 21 | }); |
| 22 | |
| 23 | test("mobile download channels use a two-column tab grid", async () => { |
| 24 | const css = await source("../styles/global.css"); |
| 25 | const mobile = css.slice(css.indexOf("@media (max-width: 640px)"), css.indexOf("@media (max-width: 360px)")); |
| 26 | |
| 27 | assert.match(mobile, /\.dl-tabs \{\s*display: grid; grid-template-columns: repeat\(2, minmax\(0, 1fr\)\)/); |
| 28 | }); |
| 29 |