From 7c49e85a0820d70e6cb0a20e2a4722e9133e937f Mon Sep 17 00:00:00 2001 From: Preschian Febryantara Date: Tue, 5 Dec 2023 19:26:14 +0700 Subject: [PATCH] * test(ipfs.test.ts): add test for successful response with status code 200 and content type text/html --- image/src/tests/ipfs.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/image/src/tests/ipfs.test.ts b/image/src/tests/ipfs.test.ts index 016e3d2..d1aa7e0 100644 --- a/image/src/tests/ipfs.test.ts +++ b/image/src/tests/ipfs.test.ts @@ -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", + } + `) +})