32 lines
1.1 KiB
JavaScript

"use strict";
const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
const test = require("node:test");
const html = fs.readFileSync(path.join(__dirname, "..", "index.html"), "utf8");
const styles = fs.readFileSync(path.join(__dirname, "..", "styles.css"), "utf8");
test("front door keeps the legally required ICP link", () => {
assert.match(html, /陕ICP备2025071211号-1/);
assert.match(html, /https:\/\/beian\.miit\.gov\.cn\//);
});
test("front door routes compute work through the JD hub", () => {
assert.match(html, /href="\/jd\/"/);
assert.match(html, /京东云主节点/);
assert.match(html, /href="https:\/\/guanghubingshuo\.com\/code\/"/);
});
test("public page never embeds infrastructure addresses or credentials", () => {
assert.doesNotMatch(html, /(?:\d{1,3}\.){3}\d{1,3}/);
assert.doesNotMatch(html, /zy_gtw_/);
assert.doesNotMatch(html, /password|private[_ -]?key|token/i);
});
test("front door has responsive card layout", () => {
assert.match(styles, /grid-template-columns:\s*repeat\(2/);
assert.match(styles, /@media\s*\(max-width:\s*760px\)/);
});