@testerpaykit/api-client 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@testerpaykit/api-client` are documented here.
4
+
5
+ ## 1.7.0 — 2026-11-01
6
+
7
+ ### Added
8
+ - `getChecklist(projectId)` — what to test in an app: the project's
9
+ checklist tasks with their steps and the tester's (`mine`) and the AI
10
+ tester's (`ai`) latest pass (`GET /v1/testers/me/checklist`). A 404
11
+ (tester not in the project yet) yields an empty list.
12
+ - `submitChecklistRun({projectId, taskId, stepResults, summary?})` — one
13
+ pass through a task with a verdict per step (`POST
14
+ /v1/testers/me/checklist/<taskId>/runs`), returns `passed`, `failed` or
15
+ `incomplete`.
16
+ - Types `ChecklistTask`, `ChecklistRun`, `ChecklistStepResult`,
17
+ `ChecklistRunInput`.
18
+
19
+ ### Changed
20
+ - `claimRemoteAiSession(projectId, appVersion?)` sends the app version, so
21
+ the API can hand AI retests of a fixed bug only to the fixed build.
22
+
23
+ ## 1.6.0 — 2026-10-31
24
+
25
+ ### Added
26
+ - `openLiveLink(projectId)` and `sendLiveNote(...)` for the live link to
27
+ Claude Code.
package/dist/index.d.mts CHANGED
@@ -9,6 +9,38 @@ interface LiveNoteInput {
9
9
  /** Base64 PNG/JPEG, no data-URI prefix. */
10
10
  screenshotBase64?: string | null;
11
11
  }
12
+ /** One step verdict of a checklist pass (`step` is 1-based). */
13
+ interface ChecklistStepResult {
14
+ step: number;
15
+ passed: boolean;
16
+ note?: string;
17
+ }
18
+ /** The latest pass through a checklist task (by this tester or the AI). */
19
+ interface ChecklistRun {
20
+ status: 'passed' | 'failed' | 'incomplete' | string;
21
+ steps: ChecklistStepResult[];
22
+ summary?: string;
23
+ at: string;
24
+ tester?: string;
25
+ }
26
+ /** One task of a project's checklist: what should be tested. */
27
+ interface ChecklistTask {
28
+ id: string;
29
+ title: string;
30
+ description?: string;
31
+ steps: string[];
32
+ /** This tester's latest pass. */
33
+ mine?: ChecklistRun;
34
+ /** The AI tester's latest pass. */
35
+ ai?: ChecklistRun;
36
+ }
37
+ /** Body of `submitChecklistRun`. */
38
+ interface ChecklistRunInput {
39
+ projectId: string;
40
+ taskId: string;
41
+ stepResults: ChecklistStepResult[];
42
+ summary?: string;
43
+ }
12
44
  interface ApiClientConfig {
13
45
  baseURL?: string;
14
46
  apiKey: string;
@@ -152,8 +184,10 @@ declare class TesterPayKitApiClient implements IApiClient {
152
184
  /**
153
185
  * Claim a remote AI-tester run waiting for this project.
154
186
  * POST /v1/testers/me/ai-sessions/claim — 204 → null.
187
+ * `appVersion` lets the API hand out AI retests of a fixed bug, which
188
+ * only a build at or above the fixed version may run.
155
189
  */
156
- claimRemoteAiSession(projectId: string): Promise<RemoteAiSession | null>;
190
+ claimRemoteAiSession(projectId: string, appVersion?: string): Promise<RemoteAiSession | null>;
157
191
  /**
158
192
  * Open a live link to the developer's Claude Code session: returns a
159
193
  * one-time WebSocket URL (valid two minutes). Fetch a fresh one for
@@ -165,6 +199,18 @@ declare class TesterPayKitApiClient implements IApiClient {
165
199
  * without an open live link. POST /v1/testers/me/live/notes → note id.
166
200
  */
167
201
  sendLiveNote(input: LiveNoteInput): Promise<string>;
202
+ /**
203
+ * What to test in this app: the project's checklist tasks with this
204
+ * tester's (`mine`) and the AI tester's (`ai`) latest pass.
205
+ * GET /v1/testers/me/checklist?project_id=… — a 404 (tester not in the
206
+ * project yet) yields an empty list.
207
+ */
208
+ getChecklist(projectId: string): Promise<ChecklistTask[]>;
209
+ /**
210
+ * One pass through a checklist task, a verdict per step.
211
+ * POST /v1/testers/me/checklist/{taskId}/runs → the run's status.
212
+ */
213
+ submitChecklistRun(input: ChecklistRunInput): Promise<string>;
168
214
  /**
169
215
  * Attach a file (screenshot, log, voice note) to an already-
170
216
  * submitted bug report. Hits POST /v1/testers/me/bug-reports/
@@ -739,4 +785,4 @@ interface TaskStep {
739
785
  }
740
786
 
741
787
  export { TesterPayKitApiClient };
742
- export type { AnonymousLoginResponse, ApiClientConfig, BugCategory, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportPayload, BugReportResponse, BugReportType, BugSeverity, EarningsSummary, EndTesterSessionInput, EnrollmentResponse, FeedbackResponse, KnowledgeBaseAnswer, KnowledgeBaseCitation, KnowledgeFile, KnowledgeFileSummary, LiveNoteInput, MyBugReportSummary, MyBugReportsResponse, NotificationsResult, PayoutRecord, RegisterDeviceInput, RetestItem, RetestStepVerdicts, SdkUpdateInfo, SessionBreadcrumbInput, SessionBreadcrumbsResponse, SessionEventInput, SessionEventsResponse, StartTesterSessionInput, SubmissionResponse, TaskListFilter, TaskListResponse, TaskPreset, TaskStep, TesterDeviceResponse, TesterPoints, TesterProfile, TesterSessionEndReason, TesterSessionResponse, TesterTask, TpkNotification };
788
+ export type { AnonymousLoginResponse, ApiClientConfig, BugCategory, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportPayload, BugReportResponse, BugReportType, BugSeverity, ChecklistRun, ChecklistRunInput, ChecklistStepResult, ChecklistTask, EarningsSummary, EndTesterSessionInput, EnrollmentResponse, FeedbackResponse, KnowledgeBaseAnswer, KnowledgeBaseCitation, KnowledgeFile, KnowledgeFileSummary, LiveNoteInput, MyBugReportSummary, MyBugReportsResponse, NotificationsResult, PayoutRecord, RegisterDeviceInput, RetestItem, RetestStepVerdicts, SdkUpdateInfo, SessionBreadcrumbInput, SessionBreadcrumbsResponse, SessionEventInput, SessionEventsResponse, StartTesterSessionInput, SubmissionResponse, TaskListFilter, TaskListResponse, TaskPreset, TaskStep, TesterDeviceResponse, TesterPoints, TesterProfile, TesterSessionEndReason, TesterSessionResponse, TesterTask, TpkNotification };
package/dist/index.d.ts CHANGED
@@ -9,6 +9,38 @@ interface LiveNoteInput {
9
9
  /** Base64 PNG/JPEG, no data-URI prefix. */
10
10
  screenshotBase64?: string | null;
11
11
  }
12
+ /** One step verdict of a checklist pass (`step` is 1-based). */
13
+ interface ChecklistStepResult {
14
+ step: number;
15
+ passed: boolean;
16
+ note?: string;
17
+ }
18
+ /** The latest pass through a checklist task (by this tester or the AI). */
19
+ interface ChecklistRun {
20
+ status: 'passed' | 'failed' | 'incomplete' | string;
21
+ steps: ChecklistStepResult[];
22
+ summary?: string;
23
+ at: string;
24
+ tester?: string;
25
+ }
26
+ /** One task of a project's checklist: what should be tested. */
27
+ interface ChecklistTask {
28
+ id: string;
29
+ title: string;
30
+ description?: string;
31
+ steps: string[];
32
+ /** This tester's latest pass. */
33
+ mine?: ChecklistRun;
34
+ /** The AI tester's latest pass. */
35
+ ai?: ChecklistRun;
36
+ }
37
+ /** Body of `submitChecklistRun`. */
38
+ interface ChecklistRunInput {
39
+ projectId: string;
40
+ taskId: string;
41
+ stepResults: ChecklistStepResult[];
42
+ summary?: string;
43
+ }
12
44
  interface ApiClientConfig {
13
45
  baseURL?: string;
14
46
  apiKey: string;
@@ -152,8 +184,10 @@ declare class TesterPayKitApiClient implements IApiClient {
152
184
  /**
153
185
  * Claim a remote AI-tester run waiting for this project.
154
186
  * POST /v1/testers/me/ai-sessions/claim — 204 → null.
187
+ * `appVersion` lets the API hand out AI retests of a fixed bug, which
188
+ * only a build at or above the fixed version may run.
155
189
  */
156
- claimRemoteAiSession(projectId: string): Promise<RemoteAiSession | null>;
190
+ claimRemoteAiSession(projectId: string, appVersion?: string): Promise<RemoteAiSession | null>;
157
191
  /**
158
192
  * Open a live link to the developer's Claude Code session: returns a
159
193
  * one-time WebSocket URL (valid two minutes). Fetch a fresh one for
@@ -165,6 +199,18 @@ declare class TesterPayKitApiClient implements IApiClient {
165
199
  * without an open live link. POST /v1/testers/me/live/notes → note id.
166
200
  */
167
201
  sendLiveNote(input: LiveNoteInput): Promise<string>;
202
+ /**
203
+ * What to test in this app: the project's checklist tasks with this
204
+ * tester's (`mine`) and the AI tester's (`ai`) latest pass.
205
+ * GET /v1/testers/me/checklist?project_id=… — a 404 (tester not in the
206
+ * project yet) yields an empty list.
207
+ */
208
+ getChecklist(projectId: string): Promise<ChecklistTask[]>;
209
+ /**
210
+ * One pass through a checklist task, a verdict per step.
211
+ * POST /v1/testers/me/checklist/{taskId}/runs → the run's status.
212
+ */
213
+ submitChecklistRun(input: ChecklistRunInput): Promise<string>;
168
214
  /**
169
215
  * Attach a file (screenshot, log, voice note) to an already-
170
216
  * submitted bug report. Hits POST /v1/testers/me/bug-reports/
@@ -739,4 +785,4 @@ interface TaskStep {
739
785
  }
740
786
 
741
787
  export { TesterPayKitApiClient };
742
- export type { AnonymousLoginResponse, ApiClientConfig, BugCategory, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportPayload, BugReportResponse, BugReportType, BugSeverity, EarningsSummary, EndTesterSessionInput, EnrollmentResponse, FeedbackResponse, KnowledgeBaseAnswer, KnowledgeBaseCitation, KnowledgeFile, KnowledgeFileSummary, LiveNoteInput, MyBugReportSummary, MyBugReportsResponse, NotificationsResult, PayoutRecord, RegisterDeviceInput, RetestItem, RetestStepVerdicts, SdkUpdateInfo, SessionBreadcrumbInput, SessionBreadcrumbsResponse, SessionEventInput, SessionEventsResponse, StartTesterSessionInput, SubmissionResponse, TaskListFilter, TaskListResponse, TaskPreset, TaskStep, TesterDeviceResponse, TesterPoints, TesterProfile, TesterSessionEndReason, TesterSessionResponse, TesterTask, TpkNotification };
788
+ export type { AnonymousLoginResponse, ApiClientConfig, BugCategory, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportPayload, BugReportResponse, BugReportType, BugSeverity, ChecklistRun, ChecklistRunInput, ChecklistStepResult, ChecklistTask, EarningsSummary, EndTesterSessionInput, EnrollmentResponse, FeedbackResponse, KnowledgeBaseAnswer, KnowledgeBaseCitation, KnowledgeFile, KnowledgeFileSummary, LiveNoteInput, MyBugReportSummary, MyBugReportsResponse, NotificationsResult, PayoutRecord, RegisterDeviceInput, RetestItem, RetestStepVerdicts, SdkUpdateInfo, SessionBreadcrumbInput, SessionBreadcrumbsResponse, SessionEventInput, SessionEventsResponse, StartTesterSessionInput, SubmissionResponse, TaskListFilter, TaskListResponse, TaskPreset, TaskStep, TesterDeviceResponse, TesterPoints, TesterProfile, TesterSessionEndReason, TesterSessionResponse, TesterTask, TpkNotification };
package/dist/index.js CHANGED
@@ -249,11 +249,13 @@ var TesterPayKitApiClient = class {
249
249
  /**
250
250
  * Claim a remote AI-tester run waiting for this project.
251
251
  * POST /v1/testers/me/ai-sessions/claim — 204 → null.
252
+ * `appVersion` lets the API hand out AI retests of a fixed bug, which
253
+ * only a build at or above the fixed version may run.
252
254
  */
253
- async claimRemoteAiSession(projectId) {
255
+ async claimRemoteAiSession(projectId, appVersion) {
254
256
  const response = await this.client.post(
255
257
  "/v1/testers/me/ai-sessions/claim",
256
- { project_id: projectId }
258
+ { project_id: projectId, ...appVersion ? { app_version: appVersion } : {} }
257
259
  );
258
260
  if (response.status === 204 || !response.data?.sessionId) return null;
259
261
  return response.data;
@@ -288,6 +290,43 @@ var TesterPayKitApiClient = class {
288
290
  );
289
291
  return response.data?.id;
290
292
  }
293
+ /**
294
+ * What to test in this app: the project's checklist tasks with this
295
+ * tester's (`mine`) and the AI tester's (`ai`) latest pass.
296
+ * GET /v1/testers/me/checklist?project_id=… — a 404 (tester not in the
297
+ * project yet) yields an empty list.
298
+ */
299
+ async getChecklist(projectId) {
300
+ try {
301
+ const response = await this.client.get(
302
+ "/v1/testers/me/checklist",
303
+ { params: { project_id: projectId } }
304
+ );
305
+ return Array.isArray(response.data?.tasks) ? response.data.tasks : [];
306
+ } catch (e) {
307
+ if (e?.response?.status === 404) return [];
308
+ throw e;
309
+ }
310
+ }
311
+ /**
312
+ * One pass through a checklist task, a verdict per step.
313
+ * POST /v1/testers/me/checklist/{taskId}/runs → the run's status.
314
+ */
315
+ async submitChecklistRun(input) {
316
+ const response = await this.client.post(
317
+ `/v1/testers/me/checklist/${encodeURIComponent(input.taskId)}/runs`,
318
+ {
319
+ project_id: input.projectId,
320
+ step_results: input.stepResults.map((r) => ({
321
+ step: r.step,
322
+ passed: r.passed,
323
+ ...r.note && r.note.trim() ? { note: r.note.trim() } : {}
324
+ })),
325
+ ...input.summary && input.summary.trim() ? { summary: input.summary.trim() } : {}
326
+ }
327
+ );
328
+ return response.data?.status;
329
+ }
291
330
  /**
292
331
  * Attach a file (screenshot, log, voice note) to an already-
293
332
  * submitted bug report. Hits POST /v1/testers/me/bug-reports/
package/dist/index.mjs CHANGED
@@ -215,11 +215,13 @@ var TesterPayKitApiClient = class {
215
215
  /**
216
216
  * Claim a remote AI-tester run waiting for this project.
217
217
  * POST /v1/testers/me/ai-sessions/claim — 204 → null.
218
+ * `appVersion` lets the API hand out AI retests of a fixed bug, which
219
+ * only a build at or above the fixed version may run.
218
220
  */
219
- async claimRemoteAiSession(projectId) {
221
+ async claimRemoteAiSession(projectId, appVersion) {
220
222
  const response = await this.client.post(
221
223
  "/v1/testers/me/ai-sessions/claim",
222
- { project_id: projectId }
224
+ { project_id: projectId, ...appVersion ? { app_version: appVersion } : {} }
223
225
  );
224
226
  if (response.status === 204 || !response.data?.sessionId) return null;
225
227
  return response.data;
@@ -254,6 +256,43 @@ var TesterPayKitApiClient = class {
254
256
  );
255
257
  return response.data?.id;
256
258
  }
259
+ /**
260
+ * What to test in this app: the project's checklist tasks with this
261
+ * tester's (`mine`) and the AI tester's (`ai`) latest pass.
262
+ * GET /v1/testers/me/checklist?project_id=… — a 404 (tester not in the
263
+ * project yet) yields an empty list.
264
+ */
265
+ async getChecklist(projectId) {
266
+ try {
267
+ const response = await this.client.get(
268
+ "/v1/testers/me/checklist",
269
+ { params: { project_id: projectId } }
270
+ );
271
+ return Array.isArray(response.data?.tasks) ? response.data.tasks : [];
272
+ } catch (e) {
273
+ if (e?.response?.status === 404) return [];
274
+ throw e;
275
+ }
276
+ }
277
+ /**
278
+ * One pass through a checklist task, a verdict per step.
279
+ * POST /v1/testers/me/checklist/{taskId}/runs → the run's status.
280
+ */
281
+ async submitChecklistRun(input) {
282
+ const response = await this.client.post(
283
+ `/v1/testers/me/checklist/${encodeURIComponent(input.taskId)}/runs`,
284
+ {
285
+ project_id: input.projectId,
286
+ step_results: input.stepResults.map((r) => ({
287
+ step: r.step,
288
+ passed: r.passed,
289
+ ...r.note && r.note.trim() ? { note: r.note.trim() } : {}
290
+ })),
291
+ ...input.summary && input.summary.trim() ? { summary: input.summary.trim() } : {}
292
+ }
293
+ );
294
+ return response.data?.status;
295
+ }
257
296
  /**
258
297
  * Attach a file (screenshot, log, voice note) to an already-
259
298
  * submitted bug report. Hits POST /v1/testers/me/bug-reports/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testerpaykit/api-client",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "API client for TesterPayKit backend",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -20,6 +20,42 @@ export interface LiveNoteInput {
20
20
  screenshotBase64?: string | null;
21
21
  }
22
22
 
23
+ /** One step verdict of a checklist pass (`step` is 1-based). */
24
+ export interface ChecklistStepResult {
25
+ step: number;
26
+ passed: boolean;
27
+ note?: string;
28
+ }
29
+
30
+ /** The latest pass through a checklist task (by this tester or the AI). */
31
+ export interface ChecklistRun {
32
+ status: 'passed' | 'failed' | 'incomplete' | string;
33
+ steps: ChecklistStepResult[];
34
+ summary?: string;
35
+ at: string;
36
+ tester?: string;
37
+ }
38
+
39
+ /** One task of a project's checklist: what should be tested. */
40
+ export interface ChecklistTask {
41
+ id: string;
42
+ title: string;
43
+ description?: string;
44
+ steps: string[];
45
+ /** This tester's latest pass. */
46
+ mine?: ChecklistRun;
47
+ /** The AI tester's latest pass. */
48
+ ai?: ChecklistRun;
49
+ }
50
+
51
+ /** Body of `submitChecklistRun`. */
52
+ export interface ChecklistRunInput {
53
+ projectId: string;
54
+ taskId: string;
55
+ stepResults: ChecklistStepResult[];
56
+ summary?: string;
57
+ }
58
+
23
59
  export interface ApiClientConfig {
24
60
  baseURL?: string;
25
61
  apiKey: string;
@@ -320,11 +356,16 @@ export class TesterPayKitApiClient implements IApiClient {
320
356
  /**
321
357
  * Claim a remote AI-tester run waiting for this project.
322
358
  * POST /v1/testers/me/ai-sessions/claim — 204 → null.
359
+ * `appVersion` lets the API hand out AI retests of a fixed bug, which
360
+ * only a build at or above the fixed version may run.
323
361
  */
324
- async claimRemoteAiSession(projectId: string): Promise<RemoteAiSession | null> {
362
+ async claimRemoteAiSession(
363
+ projectId: string,
364
+ appVersion?: string,
365
+ ): Promise<RemoteAiSession | null> {
325
366
  const response = await this.client.post<RemoteAiSession>(
326
367
  '/v1/testers/me/ai-sessions/claim',
327
- { project_id: projectId },
368
+ { project_id: projectId, ...(appVersion ? { app_version: appVersion } : {}) },
328
369
  );
329
370
  if (response.status === 204 || !response.data?.sessionId) return null;
330
371
  return response.data;
@@ -362,6 +403,45 @@ export class TesterPayKitApiClient implements IApiClient {
362
403
  return response.data?.id;
363
404
  }
364
405
 
406
+ /**
407
+ * What to test in this app: the project's checklist tasks with this
408
+ * tester's (`mine`) and the AI tester's (`ai`) latest pass.
409
+ * GET /v1/testers/me/checklist?project_id=… — a 404 (tester not in the
410
+ * project yet) yields an empty list.
411
+ */
412
+ async getChecklist(projectId: string): Promise<ChecklistTask[]> {
413
+ try {
414
+ const response = await this.client.get<{ tasks?: ChecklistTask[] }>(
415
+ '/v1/testers/me/checklist',
416
+ { params: { project_id: projectId } },
417
+ );
418
+ return Array.isArray(response.data?.tasks) ? response.data.tasks : [];
419
+ } catch (e) {
420
+ if ((e as { response?: { status?: number } })?.response?.status === 404) return [];
421
+ throw e;
422
+ }
423
+ }
424
+
425
+ /**
426
+ * One pass through a checklist task, a verdict per step.
427
+ * POST /v1/testers/me/checklist/{taskId}/runs → the run's status.
428
+ */
429
+ async submitChecklistRun(input: ChecklistRunInput): Promise<string> {
430
+ const response = await this.client.post<{ status: string }>(
431
+ `/v1/testers/me/checklist/${encodeURIComponent(input.taskId)}/runs`,
432
+ {
433
+ project_id: input.projectId,
434
+ step_results: input.stepResults.map((r) => ({
435
+ step: r.step,
436
+ passed: r.passed,
437
+ ...(r.note && r.note.trim() ? { note: r.note.trim() } : {}),
438
+ })),
439
+ ...(input.summary && input.summary.trim() ? { summary: input.summary.trim() } : {}),
440
+ },
441
+ );
442
+ return response.data?.status;
443
+ }
444
+
365
445
  /**
366
446
  * Attach a file (screenshot, log, voice note) to an already-
367
447
  * submitted bug report. Hits POST /v1/testers/me/bug-reports/
@@ -189,6 +189,19 @@ describe('TesterPayKitApiClient', () => {
189
189
  expect(mockAxiosInstance.post).toHaveBeenCalledWith('/v1/testers/me/live', { project_id: 'p-1' });
190
190
  });
191
191
 
192
+ it('claims a remote AI run with the app version, 204 means none', async () => {
193
+ mockAxiosInstance.post.mockResolvedValue({ status: 200, data: { sessionId: 's-1', wsUrl: 'ws://x' } });
194
+ await expect(client.claimRemoteAiSession('p-1', '1.4.0')).resolves.toMatchObject({ sessionId: 's-1' });
195
+ expect(mockAxiosInstance.post).toHaveBeenCalledWith('/v1/testers/me/ai-sessions/claim', {
196
+ project_id: 'p-1', app_version: '1.4.0',
197
+ });
198
+ mockAxiosInstance.post.mockResolvedValue({ status: 204, data: '' });
199
+ await expect(client.claimRemoteAiSession('p-1')).resolves.toBeNull();
200
+ expect(mockAxiosInstance.post).toHaveBeenLastCalledWith('/v1/testers/me/ai-sessions/claim', {
201
+ project_id: 'p-1',
202
+ });
203
+ });
204
+
192
205
  it('rejects when the server sends no wsUrl', async () => {
193
206
  mockAxiosInstance.post.mockResolvedValue({ data: {} });
194
207
  await expect(client.openLiveLink('p-1')).rejects.toThrow(/wsUrl/);
@@ -209,6 +222,53 @@ describe('TesterPayKitApiClient', () => {
209
222
  });
210
223
  });
211
224
 
225
+ describe('checklist', () => {
226
+ it('reads the checklist of a project', async () => {
227
+ const tasks = [{ id: 't1', title: 'Login', steps: ['Open', 'Sign in'], mine: { status: 'passed', steps: [], at: 'x' } }];
228
+ mockAxiosInstance.get.mockResolvedValue({ data: { tasks } });
229
+ await expect(client.getChecklist('p-1')).resolves.toEqual(tasks);
230
+ expect(mockAxiosInstance.get).toHaveBeenCalledWith('/v1/testers/me/checklist', { params: { project_id: 'p-1' } });
231
+ });
232
+
233
+ it('treats 404 (not in the project yet) as an empty checklist', async () => {
234
+ mockAxiosInstance.get.mockRejectedValue({ response: { status: 404 } });
235
+ await expect(client.getChecklist('p-1')).resolves.toEqual([]);
236
+ });
237
+
238
+ it('rethrows other errors', async () => {
239
+ mockAxiosInstance.get.mockRejectedValue({ response: { status: 500 } });
240
+ await expect(client.getChecklist('p-1')).rejects.toEqual({ response: { status: 500 } });
241
+ });
242
+
243
+ it('returns an empty list when the body carries no tasks', async () => {
244
+ mockAxiosInstance.get.mockResolvedValue({ data: {} });
245
+ await expect(client.getChecklist('p-1')).resolves.toEqual([]);
246
+ });
247
+
248
+ it('submits a run with step verdicts, trimmed notes and summary', async () => {
249
+ mockAxiosInstance.post.mockResolvedValue({ data: { status: 'failed' } });
250
+ await expect(
251
+ client.submitChecklistRun({
252
+ projectId: 'p-1',
253
+ taskId: 't1',
254
+ stepResults: [
255
+ { step: 1, passed: true, note: ' ' },
256
+ { step: 2, passed: false, note: ' button dead ' },
257
+ ],
258
+ summary: ' meh ',
259
+ }),
260
+ ).resolves.toBe('failed');
261
+ expect(mockAxiosInstance.post).toHaveBeenCalledWith('/v1/testers/me/checklist/t1/runs', {
262
+ project_id: 'p-1',
263
+ step_results: [
264
+ { step: 1, passed: true },
265
+ { step: 2, passed: false, note: 'button dead' },
266
+ ],
267
+ summary: 'meh',
268
+ });
269
+ });
270
+ });
271
+
212
272
  describe('tester sessions', () => {
213
273
  it('should start a tester session with server contract field names', async () => {
214
274
  const response = {