import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
const root = new URL("../app/static/", import.meta.url);
test("settings places unrestricted FRP maintenance at the bottom", async () => {
const html = await readFile(new URL("index.html", root), "utf8");
const settings = html.slice(html.indexOf('id="workspace-settings"'));
assert.match(settings, /
frp配置<\/h3>/);
assert.match(settings, /此功能通常是远程排查使用,请保证你知道你在做什么。/);
assert.match(settings, />启动frp<\/button>/);
assert.match(settings, />编辑配置文件<\/button>/);
assert.match(settings, />网络检测<\/button>/);
assert.ok(settings.indexOf("frp-setting-card") > settings.indexOf('id="animation-preview-max-concurrent"'));
});
test("FRP editor uses raw server storage and official validation errors", async () => {
const source = await readFile(new URL("views/frp-settings.js", root), "utf8");
assert.match(source, /\/api\/frp\/configs/);
assert.match(source, /Content-Type": "text\/plain; charset=utf-8"/);
assert.match(source, /正在使用 frpc 校验配置/);
assert.match(source, /discardFrpDrafts/);
assert.doesNotMatch(source, /localStorage|sessionStorage/);
});
test("network diagnostics renders layered evidence", async () => {
const source = await readFile(new URL("views/frp-settings.js", root), "utf8");
assert.match(source, /\/api\/network\/diagnostics/);
assert.match(source, /网络检测失败/);
assert.match(source, /result\.checks\.forEach/);
});