Skip to content

Commit eef5361

Browse files
committed
chore: fix test
1 parent 29d5b5d commit eef5361

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/main.test.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,9 @@ describe('set', () => {
280280
expect(options?.method).toBe('put')
281281

282282
if (url === `https://api.netlify.com/api/v1/sites/${siteID}/blobs/${key}?context=production`) {
283-
const data = JSON.stringify({ url: signedURL })
284-
285283
expect(headers.authorization).toBe(`Bearer ${apiToken}`)
286284

287-
return new Response(data)
288-
}
289-
290-
if (url === signedURL) {
291-
return new Response('Something went wrong', { status: 401 })
285+
return new Response(null, { status: 401 })
292286
}
293287

294288
throw new Error(`Unexpected fetch call: ${url}`)
@@ -303,7 +297,7 @@ describe('set', () => {
303297
})
304298

305299
expect(async () => await blobs.set(key, 'value')).rejects.toThrowError(
306-
'put operation has failed: Something went wrong',
300+
'put operation has failed: API returned a 401 response',
307301
)
308302
})
309303
})
@@ -354,11 +348,9 @@ describe('delete', () => {
354348
expect(options?.method).toBe('delete')
355349

356350
if (url === `https://api.netlify.com/api/v1/sites/${siteID}/blobs/${key}?context=production`) {
357-
const data = JSON.stringify({ url: signedURL })
358-
359351
expect(headers.authorization).toBe(`Bearer ${apiToken}`)
360352

361-
return new Response(data)
353+
return new Response(null, { status: 401 })
362354
}
363355

364356
if (url === signedURL) {
@@ -377,7 +369,7 @@ describe('delete', () => {
377369
})
378370

379371
expect(async () => await blobs.delete(key)).rejects.toThrowError(
380-
'delete operation has failed: Something went wrong',
372+
'delete operation has failed: API returned a 401 response',
381373
)
382374
})
383375
})

0 commit comments

Comments
 (0)