Skip to content

Commit e18d68e

Browse files
kriszypclaude
andcommitted
fix(test): blob suite — tautological || in size assertion, prettier
x >= 80000 || x <= 120000 is always true for any integer — fix to && so the range is actually checked. Applies to both the create and read blob tests. Also apply prettier formatting. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b79e40d commit e18d68e

1 file changed

Lines changed: 7 additions & 24 deletions

File tree

integrationTests/apiTests/blob.test.mjs

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,7 @@ suite('Blob lifecycle', { skip: skipSuite }, (ctx) => {
9999
.send({ operation: 'add_component', project: 'blobs' })
100100
.expect((r) => {
101101
const res = JSON.stringify(r.body);
102-
assert.ok(
103-
res.includes('Successfully added project') || res.includes('Project already exists'),
104-
r.text
105-
);
102+
assert.ok(res.includes('Successfully added project') || res.includes('Project already exists'), r.text);
106103
});
107104

108105
await client
@@ -131,10 +128,7 @@ suite('Blob lifecycle', { skip: skipSuite }, (ctx) => {
131128
.req()
132129
.send({ operation: 'describe_all' })
133130
.expect((r) => {
134-
assert.ok(
135-
JSON.stringify(r.body).includes('"blob":{"BlobCache":{"schema":"blob","name":"BlobCache"'),
136-
r.text
137-
);
131+
assert.ok(JSON.stringify(r.body).includes('"blob":{"BlobCache":{"schema":"blob","name":"BlobCache"'), r.text);
138132
})
139133
.expect(200);
140134
});
@@ -146,8 +140,7 @@ suite('Blob lifecycle', { skip: skipSuite }, (ctx) => {
146140
.set('Accept', '*/*')
147141
.expect((r) => {
148142
assert.ok(
149-
parseInt(r.headers['content-length']) >= 80000 ||
150-
parseInt(r.headers['content-length']) <= 120000,
143+
parseInt(r.headers['content-length']) >= 80000 && parseInt(r.headers['content-length']) <= 120000,
151144
'blob content-length out of expected range\n' + r.text
152145
);
153146
})
@@ -157,10 +150,7 @@ suite('Blob lifecycle', { skip: skipSuite }, (ctx) => {
157150
});
158151

159152
test('blob record exists in DB with correct metadata', async () => {
160-
const r = await client
161-
.req()
162-
.send({ operation: 'sql', sql: 'SELECT * FROM blob.BlobCache' })
163-
.expect(200);
153+
const r = await client.req().send({ operation: 'sql', sql: 'SELECT * FROM blob.BlobCache' }).expect(200);
164154

165155
assert.ok(Array.isArray(r.body), r.text);
166156
const record = r.body.find((item) => item.cacheKey === blobId.toString());
@@ -199,8 +189,7 @@ suite('Blob lifecycle', { skip: skipSuite }, (ctx) => {
199189
.set('Accept', '*/*')
200190
.expect((r) => {
201191
assert.ok(
202-
parseInt(r.headers['content-length']) >= 80000 ||
203-
parseInt(r.headers['content-length']) <= 120000,
192+
parseInt(r.headers['content-length']) >= 80000 && parseInt(r.headers['content-length']) <= 120000,
204193
r.text
205194
);
206195
})
@@ -236,10 +225,7 @@ suite('Blob lifecycle', { skip: skipSuite }, (ctx) => {
236225
test('create a second blob before drop_table', async () => {
237226
await setTimeout(5000);
238227
const id2 = randomInt(1000000);
239-
await client
240-
.reqRest(`/blobcache/${id2}`)
241-
.set('Accept', '*/*')
242-
.expect(200);
228+
await client.reqRest(`/blobcache/${id2}`).set('Accept', '*/*').expect(200);
243229
});
244230

245231
test('drop_table BlobCache removes blob files', async () => {
@@ -267,10 +253,7 @@ suite('Blob lifecycle', { skip: skipSuite }, (ctx) => {
267253
});
268254

269255
test("drop_schema 'blob' removes blob files", async () => {
270-
await client
271-
.req()
272-
.send({ operation: 'drop_schema', schema: 'blob' })
273-
.expect(200);
256+
await client.req().send({ operation: 'drop_schema', schema: 'blob' }).expect(200);
274257

275258
await setTimeout(21000);
276259

0 commit comments

Comments
 (0)