Files
growqr-backend/scripts/matchmaking-events.test.ts
2026-07-13 20:14:14 +00:00

54 lines
1.6 KiB
TypeScript

import assert from "node:assert/strict";
import { buildMatchmakingGatewayEvent } from "../src/services/matchmaking-events.js";
const saved = buildMatchmakingGatewayEvent({
userId: "user_test",
action: "mark_saved",
body: {
action: "mark_saved",
params: {
opportunity_id: "job_123",
curatorTaskId: "task_123",
missionId: "curator-sprint",
missionInstanceId: "sprint_123",
stageId: "stage_123",
source: "curator-v1",
},
},
result: { task_id: "a2a_123", status: "completed", messages: [] },
});
assert.equal(saved.type, "matchmaking.match.saved");
assert.deepEqual(saved.mission, {
missionId: "curator-sprint",
instanceId: "sprint_123",
stageId: "stage_123",
source: "curator-v1",
});
assert.deepEqual(saved.subject, {
serviceId: "matchmaking",
kind: "opportunity",
id: "job_123",
externalId: "job_123",
});
assert.equal(saved.correlation?.taskId, "task_123");
assert.equal(saved.correlation?.curatorTaskId, "task_123");
assert.equal(saved.correlation?.opportunityId, "job_123");
assert.equal(saved.payload.curatorTaskId, "task_123");
assert.equal(saved.payload.opportunityId, "job_123");
assert.equal(saved.payload.action, "mark_saved");
const reviewed = buildMatchmakingGatewayEvent({
userId: "user_test",
action: "record_feedback",
body: {
action: "record_feedback",
params: { opportunity_id: "job_123", curatorTaskId: "task_123" },
},
result: { task_id: "a2a_456", status: "completed", messages: [] },
});
assert.equal(reviewed.type, "matchmaking.matches.reviewed");
console.log("matchmaking-events tests passed");
process.exit(0);