guanghu-ice-heart/server-tools/zero-sense-team-node/test/template.test.js

34 lines
1.4 KiB
JavaScript
Raw Permalink Normal View History

const test = require("node:test");
const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
const root = path.resolve(__dirname, "..");
test("supports the current Ubuntu LTS baselines", () => {
const source = fs.readFileSync(path.join(root, "install.sh"), "utf8");
assert.match(source, /22\\.04\\|24\\.04/);
});
test("official binary download resumes instead of restarting", () => {
const source = fs.readFileSync(path.join(root, "install.sh"), "utf8");
assert.match(source, /--continue-at -/);
assert.match(source, /sha256sum -c/);
});
test("Forgejo stays on loopback and registration is disabled", () => {
const ini = fs.readFileSync(path.join(root, "app.ini.template"), "utf8");
assert.match(ini, /HTTP_ADDR = 127\.0\.0\.1/);
assert.match(ini, /DISABLE_REGISTRATION = true/);
});
test("node belongs to zero-sense and enterprise upstream", () => {
const source = fs.readFileSync(path.join(root, "install.sh"), "utf8");
assert.match(source, /DOMAIN-ZS/);
assert.match(source, /AW-GZ-001/);
assert.doesNotMatch(source, /owner:"ICE-GL/);
});
test("secrets and recipient email are not embedded", () => {
const combined = fs.readdirSync(root).filter(name => fs.statSync(path.join(root, name)).isFile()).map(name => fs.readFileSync(path.join(root, name), "utf8")).join("\n");
assert.doesNotMatch(combined, /@qq\.com|BEGIN .*PRIVATE KEY|Bearer [A-Za-z0-9]/);
});