import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import test from "node:test"; import { rectificationAgentRouteSurface } from "./rectification-agent-route-surface.ts"; const pricingSimulation = readFileSync( fileURLToPath(new URL("../src/lib/pricing-simulation.ts", import.meta.url)), "utf8", ); const productManagement = readFileSync( fileURLToPath(new URL("../src/components/admin/product-management.tsx", import.meta.url)), "utf8", ); // 原值: 读 app/api/rectification/agent/route.ts 单文件。新值: rectificationAgentRouteSurface(route.ts + 拆出的 agent-route-*.ts,见 rectification-agent-route-surface.ts)。原因: TASK-rectification-code-split-20260926 只搬不改,整文件断言跟着代码走;切片断言另行改写。 const rectificationRoute = rectificationAgentRouteSurface; test("documents billingLimit as a circuit breaker rather than a chat quota", () => { assert.match(pricingSimulation, /billingLimit is an anomaly-account circuit breaker/); assert.match(productManagement, /billingLimit 仅用于异常账号熔断/); assert.match(productManagement, /minuteLimit 与 dayLimit/); assert.match(productManagement, /生时校正与完整报告单独计费/); }); test("fair-use billing-period messaging avoids promising a quota", () => { assert.match(rectificationRoute, /code === "fair_use_billing_period"[\s\S]*安全熔断,请稍后再试或联系支持/); assert.doesNotMatch(rectificationRoute, /fair_use_billing_period[\s\S]{0,240}配额用完/); });