Skip to content

Commit

Permalink
Add missing compression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Jul 31, 2024
1 parent 3e89cd4 commit 1b06bf1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/fetch/decompress.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,27 @@ test('decompresses responses with "gzip" encoding', async () => {
)
assert.deepStrictEqual(await new Response(body).text(), 'hello world')
})

test('decompresses responses with "x-gzip" encoding', async () => {
const body = decompress(
new Request(url),
new Response(zlib.gzipSync('hello world'), {
headers: {
'content-encoding': 'x-gzip'
}
})
)
assert.deepStrictEqual(await new Response(body).text(), 'hello world')
})

test('decompresses responses with "gzip, br" encoding', async () => {
const body = decompress(
new Request(url),
new Response(zlib.brotliCompressSync(zlib.gzipSync('hello world')), {
headers: {
'content-encoding': 'gzip, br'
}
})
)
assert.deepStrictEqual(await new Response(body).text(), 'hello world')
})

0 comments on commit 1b06bf1

Please sign in to comment.