Skip to content

Commit 7226291

Browse files
designcodeclaude
andauthored
fix: update integration tests for paginated JSON schema (#78)
* fix: update integration tests for new paginated JSON schema JSON output from list commands now returns { items: [...] } instead of a flat array. Update the two integration tests that parsed JSON output as flat arrays to use parsed.items instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: update stale bucket cleanup to use paginated JSON schema The beforeAll cleanup also parsed buckets list JSON as a flat array. Silently failed in the catch block, leaving stale test buckets. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c080ce0 commit 7226291

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

test/cli.test.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,11 @@ describe.skipIf(skipTests)('CLI Integration Tests', () => {
275275
const listResult = runCli('buckets list --format json');
276276
if (listResult.exitCode === 0 && listResult.stdout.trim()) {
277277
try {
278-
const buckets = JSON.parse(listResult.stdout.trim()) as Array<{
279-
name: string;
280-
created: string;
281-
}>;
278+
const parsed = JSON.parse(listResult.stdout.trim()) as {
279+
items: Array<{ name: string; created: string }>;
280+
};
282281
const now = Date.now();
283-
for (const bucket of buckets) {
282+
for (const bucket of parsed.items) {
284283
if (!bucket.name.startsWith('tigris-cli-test-')) continue;
285284
const age = now - new Date(bucket.created).getTime();
286285
if (age > staleThresholdMs) {
@@ -1156,10 +1155,10 @@ describe.skipIf(skipTests)('CLI Integration Tests', () => {
11561155
const result = runCli('buckets list --format json');
11571156
expect(result.exitCode).toBe(0);
11581157
const parsed = JSON.parse(result.stdout.trim());
1159-
expect(Array.isArray(parsed)).toBe(true);
1160-
expect(parsed.some((b: { name: string }) => b.name === testBucket)).toBe(
1161-
true
1162-
);
1158+
expect(Array.isArray(parsed.items)).toBe(true);
1159+
expect(
1160+
parsed.items.some((b: { name: string }) => b.name === testBucket)
1161+
).toBe(true);
11631162
});
11641163
});
11651164

@@ -1810,10 +1809,10 @@ describe.skipIf(skipTests)('CLI Integration Tests', () => {
18101809
const result = runCli(`snapshots list ${snapBucket} --format json`);
18111810
expect(result.exitCode).toBe(0);
18121811
const parsed = JSON.parse(result.stdout.trim());
1813-
expect(Array.isArray(parsed)).toBe(true);
1814-
expect(parsed.length).toBeGreaterThan(0);
1812+
expect(Array.isArray(parsed.items)).toBe(true);
1813+
expect(parsed.items.length).toBeGreaterThan(0);
18151814
// Save version for later tests
1816-
snapshotVersion = parsed[0].version;
1815+
snapshotVersion = parsed.items[0].version;
18171816
expect(snapshotVersion).toBeTruthy();
18181817
});
18191818

0 commit comments

Comments
 (0)