Skip to content

Commit

Permalink
add test-zlib-object-write.js test
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Aug 27, 2024
1 parent 6053f8f commit c3e804e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/workerd/api/node/tests/zlib-nodejs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,29 @@ export const zlibConst = {
},
};

// Tests are taken from:
// https://github.com/nodejs/node/blob/3a71ccf6c473357e89be61b26739fd9139dce4db/test/parallel/test-zlib-object-write.js

export const zlibObjectWrite = {
async test() {
const { promise, resolve, reject } = Promise.withResolvers();
const gunzip = new zlib.Gunzip({ objectMode: true });
gunzip.on('error', reject);
assert.throws(
() => {
gunzip.write({});
},
{
name: 'TypeError',
code: 'ERR_INVALID_ARG_TYPE',
}
);
gunzip.on('close', resolve);
gunzip.close();
await promise;
},
};

// Node.js tests relevant to zlib
//
// - [ ] test-zlib-brotli-16GB.js
Expand Down Expand Up @@ -837,7 +860,7 @@ export const zlibConst = {
// - [x] test-zlib-bytes-read.js
// - [ ] test-zlib-destroy-pipe.js
// - [ ] test-zlib-from-gzip.js
// - [ ] test-zlib-object-write.js
// - [x] test-zlib-object-write.js
// - [ ] test-zlib-write-after-flush.js
// - [x] test-zlib-close-after-error.js
// - [ ] test-zlib-dictionary-fail.js
Expand Down

0 comments on commit c3e804e

Please sign in to comment.