Skip to content

Commit

Permalink
* test(ipfs.test.ts): add test for successful response with status co…
Browse files Browse the repository at this point in the history
…de 200 and content type text/html
  • Loading branch information
preschian committed Dec 5, 2023
1 parent 50e05b6 commit 7c49e85
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions image/src/tests/ipfs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,22 @@ test('ipfs - 301 - html', async () => {
}
`)
})

test('ipfs - 200 - html', async () => {
const res = await fetch(
'https://image-beta.w.kodadot.xyz/ipfs/bafybeiakkzle3zsycvzpnkqtffqyq7njkt63vnmatkwijbg7kchq6s4she/?hash=0x850b8f12e91fe48ad55cfb6bd8ee7b33adde24ebdf266ff8d23667c828c7e989'
)

expect(res.ok).toBe(true)
expect(res.status).toBe(200)
expect(res.headers.get('content-type')).toBe('text/html')

const data = await res.blob()
expect(data).toMatchInlineSnapshot(`
Blob {
Symbol(kHandle): Blob {},
Symbol(kLength): 657,
Symbol(kType): "text/html",
}
`)
})

0 comments on commit 7c49e85

Please sign in to comment.