Skip to content

Commit c231096

Browse files
kriszypclaude
andcommitted
test: address review comments on waitForJob and waitForCondition usage
- waitForJob: fix falsy-status early-exit — `status !== 'IN_PROGRESS'` exits immediately when job is not found / response is malformed, rather than polling until timeout - northwind: replace redundant post-waitForCondition assertions with a .catch() re-throw that appends lastResponse.text to the timeout error, making failure messages reachable and useful (#2 and #3) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d806c4d commit c231096

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

integrationTests/apiTests/northwind.test.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8759,8 +8759,9 @@ suite('Northwind operations', { skip: skipSuite }, (ctx) => {
87598759
return lastResponse.body[0]?.row_count === 30;
87608760
},
87618761
{ timeoutMs: 30_000, description: 'northnwd.suppliers row_count to reach 30' }
8762-
);
8763-
assert.equal(lastResponse.body[0].row_count, 30, lastResponse.text);
8762+
).catch((err) => {
8763+
throw new Error(`${err.message} — last response: ${lastResponse?.text}`, { cause: err });
8764+
});
87648765
});
87658766

87668767
test.skip('Import CSV from S3 to table w/ full attr perms - update', async () => {
@@ -12233,8 +12234,9 @@ suite('Northwind operations', { skip: skipSuite }, (ctx) => {
1223312234
return lastResponse.body.length === 1;
1223412235
},
1223512236
{ timeoutMs: 30_000, description: 'test_job.runner to contain 1 row' }
12236-
);
12237-
assert.equal(lastResponse.body.length, 1, lastResponse.text);
12237+
).catch((err) => {
12238+
throw new Error(`${err.message} — last response: ${lastResponse?.text}`, { cause: err });
12239+
});
1223812240
});
1223912241

1224012242
test('Jobs - Test Remove Files Before with test_user', async () => {

integrationTests/apiTests/utils/operations.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function waitForJob(client, jobId, options = {}) {
3939
while (true) {
4040
response = await client.req().send({ operation: 'get_job', id: jobId }).expect(200);
4141
const status = response.body[0]?.status;
42-
if (status && status !== 'IN_PROGRESS') return response;
42+
if (status !== 'IN_PROGRESS') return response;
4343
if (Date.now() >= deadline) {
4444
throw new Error(`waitForJob: job ${jobId} still IN_PROGRESS after ${timeoutMs}ms: ${response.text}`);
4545
}

0 commit comments

Comments
 (0)