Skip to content

Commit 2103841

Browse files
committed
Update tests now that new Node decodes zstd in fetch automatically
1 parent ad9e06d commit 2103841

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

test/encodings.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,23 @@ describe('Encoding Endpoints', () => {
3636
},
3737
{
3838
name: 'zstd',
39-
expectedJson: { zstd: true },
40-
decoder: zlib.zstdDecompressSync
39+
expectedJson: { zstd: true }
4140
},
4241
{
4342
name: 'identity',
4443
expectedJson: { identity: true }
4544
}
4645
];
4746

48-
testCases.forEach(({ name, encodingName, expectedJson, decoder }) => {
47+
testCases.forEach(({ name, encodingName, expectedJson }) => {
4948
it(`/encoding/${name} should return decodeable content`, async () => {
5049
const url = `http://localhost:${serverPort}/encoding/${name}`;
5150
const response = await fetch(url);
5251

5352
expect(response.status).to.equal(200);
5453
expect(response.headers.get('content-encoding')).to.equal(encodingName || name);
5554

56-
const actualJson = decoder
57-
? JSON.parse(decoder(await response.arrayBuffer()).toString('utf8'))
58-
: await response.json(); // Decodeable by fetch automatically
55+
const actualJson = await response.json(); // Content is decodeable by fetch automatically
5956

6057
expect(actualJson).to.deep.equals(expectedJson);
6158
});

0 commit comments

Comments
 (0)