(port: number, sessionIds: string[], requests: number)
| 418 | } |
| 419 | |
| 420 | async function exerciseSessionApi(port: number, sessionIds: string[], requests: number) { |
| 421 | const actions = ["list", "context", "review", "comment-list"] as const; |
| 422 | for (let index = 0; index < requests; index += 1) { |
| 423 | const action = actions[index % actions.length]; |
| 424 | const sessionId = sessionIds[index % sessionIds.length]; |
| 425 | if (action === "list") { |
| 426 | await postSessionApi(port, { action }); |
| 427 | } else if (action === "review") { |
| 428 | await postSessionApi(port, { |
| 429 | action, |
| 430 | selector: { sessionId }, |
| 431 | includePatch: true, |
| 432 | includeNotes: true, |
| 433 | }); |
| 434 | } else { |
| 435 | await postSessionApi(port, { action, selector: { sessionId } }); |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | async function closeSockets(sockets: WebSocket[]) { |
| 441 | await Promise.all( |
no test coverage detected