23 lines
812 B
TypeScript
23 lines
812 B
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import test from "node:test";
|
|
|
|
const source = readFileSync(
|
|
fileURLToPath(new URL("../src/lib/feature-pricing.ts", import.meta.url)),
|
|
"utf8",
|
|
);
|
|
|
|
test("feature pricing resolver calls the server-side RPC and validates its row", () => {
|
|
assert.match(source, /rpc\("resolve_feature_pricing"/);
|
|
assert.match(source, /p_feature_key: featureKey/);
|
|
assert.match(source, /p_model_id: modelId/);
|
|
assert.match(source, /feature_pricing_invalid_response/);
|
|
});
|
|
|
|
test("feature pricing resolver has explicit fail-closed errors", () => {
|
|
assert.match(source, /error\.message/);
|
|
assert.match(source, /feature_pricing_unavailable/);
|
|
assert.match(source, /class FeaturePricingError/);
|
|
});
|