Files
growqr-backend/scripts/curator-direct-completion-policy.test.ts

21 lines
1012 B
TypeScript

import assert from "node:assert/strict";
import { allowsDirectServiceCompletion } from "../src/v1/curator/curator-actor.js";
import { v1CuratorRoutes } from "../src/v1/curator/curator-routes.js";
assert.equal(
allowsDirectServiceCompletion(undefined, "matchmaking_matches_reviewed"),
false,
"a recovered or arbitrary task ID must not bypass exact Curator task lookup",
);
assert.equal(allowsDirectServiceCompletion("matchmaking-service", "matchmaking_matches_reviewed"), true);
assert.equal(allowsDirectServiceCompletion("qscore-service", "qscore_review_opened"), true);
assert.equal(allowsDirectServiceCompletion("resume-service", "resume_uploaded"), false);
const serviceImpactRoute = v1CuratorRoutes().routes.find(
(route) => route.method === "POST" && route.path === "/events/service-impact",
);
assert.equal(serviceImpactRoute, undefined, "the false-positive service-impact compatibility route must not be exposed");
console.log("curator direct-completion policy tests passed");
process.exit(0);