44 lines
1.6 KiB
JavaScript
44 lines
1.6 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("front door separates the domestic primary repository from historical repositories", () => {
|
|
assert.match(html, /href="\/fifth-domain\/bingshuo\/fifth-domain"/);
|
|
assert.match(html, /第五域国内主代码仓库/);
|
|
assert.match(html, /历史仓库/);
|
|
assert.match(html, /href="https:\/\/guanghubingshuo\.com\/code\/"/);
|
|
});
|
|
|
|
test("public copy uses the domestic Fifth Domain name instead of the cloud vendor", () => {
|
|
assert.doesNotMatch(html, /京东云/);
|
|
assert.match(html, /国内第五域主节点/);
|
|
});
|
|
|
|
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\)/);
|
|
});
|