MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / handler

Function handler

src/commands/test.run.spec.ts:1306–1346  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

1304}) {
1305 const counts = { trigger: 0, type: 0, result: 0, run: 0 };
1306 const handler = (url: string) => {
1307 if (url.includes('/tests/test_be/runs')) {
1308 counts.trigger += 1;
1309 return { body: TRIGGER_RESP };
1310 }
1311 if (url.includes('/tests/test_be/result')) {
1312 counts.result += 1;
1313 return { body: args.result() };
1314 }
1315 if (url.includes('/runs/run_abc')) {
1316 counts.run += 1;
1317 // A realistic BE run row: real correlation metadata (testId === the
1318 // triggered test, project/user populated) but stuck non-terminal.
1319 return {
1320 body: {
1321 ...makePassedRun(),
1322 testId: 'test_be',
1323 projectId: 'project_be',
1324 userId: 'user_be',
1325 status: args.runStatus ?? 'running',
1326 finishedAt: null,
1327 },
1328 };
1329 }
1330 if (url.includes('/tests/test_be')) {
1331 counts.type += 1;
1332 return {
1333 body: {
1334 id: 'test_be',
1335 projectId: 'p1',
1336 name: 'BE test',
1337 type: args.type ?? 'backend',
1338 createdFrom: 'mcp',
1339 status: 'running',
1340 createdAt: '2026-05-15T10:00:00.000Z',
1341 updatedAt: '2026-05-15T10:00:00.000Z',
1342 },
1343 };
1344 }
1345 return { status: 404, body: {} };
1346 };
1347 return { handler, counts };
1348}
1349

Callers 7

makeFetchFunction · 0.70
makeFetchFunction · 0.70
makeFetchFunction · 0.70
makeFetchFunction · 0.70
makeFetchFunction · 0.70
makeFetchFunction · 0.70
makeFetchFunction · 0.70

Calls 2

makePassedRunFunction · 0.70
makeBeResultFunction · 0.70

Tested by

no test coverage detected