Files
Jyotisha/frontend/tests/membership-fair-use-contract.test.ts
T
2026-08-31 10:00:03 +08:00

30 lines
1.2 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import test from "node:test";
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",
);
const rectificationRoute = readFileSync(
fileURLToPath(new URL("../src/app/api/rectification/agent/route.ts", import.meta.url)),
"utf8",
);
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}配额用完/);
});