"use strict";
const test = require("node:test");
const assert = require("node:assert/strict");
const fs = require("node:fs");
const source = fs.readFileSync(__dirname + "/engine-v3.js", "utf8");

test("direct email bypass is removed", () => {
  assert.doesNotMatch(source, /requestEmail|email_mode:\s*requestEmail|直接使用，不查白名单/);
  assert.match(source, /禁止客户端指定邮箱/);
});
test("work-session lifecycle endpoints exist", () => {
  for (const route of ["/auth/session/request", "/auth/session/confirm", "/auth/session/exec", "/auth/session/end"]) assert.match(source, new RegExp(route.replaceAll("/", "\\/")));
});
test("Zhulan and Canger identities are registered", () => {
  assert.match(source, /ICE-GL∞-ZL-001/);
  assert.match(source, /TCS-GL-009/);
  assert.match(source, /PTS-VA-001-EED/);
  assert.match(source, /ICE-GL-CA001/);
});
