Skip to content

Commit

Permalink
add test for write after close
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Aug 22, 2024
1 parent ad5bd1a commit e262f5e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/workerd/api/node/tests/zlib-nodejs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,27 @@ export const closeAfterError = {
},
};

// Tests are taken from:
// https://github.com/nodejs/node/blob/561bc87c7607208f0d3db6dcd9231efeb48cfe2f/test/parallel/test-zlib-write-after-close.js
// Enable the test once `gzip` implementation lands.
// export const writeAfterClose = {
// async test() {
// const { promise, resolve } = Promise.withResolvers();
// let closeCalled = false;
// zlib.gzip('hello', function (err, out) {
// const unzip = zlib.createGunzip();
// unzip.close(() => (closeCalled = true));
// unzip.write('asd', (err) => {
// strictEqual(err.code, 'ERR_STREAM_DESTROYED');
// strictEqual(err.name, 'Error');
// resolve();
// });
// });
// await promise;
// assert(closeCalled, 'Close should have been called');
// },
// };

// Node.js tests relevant to zlib
//
// - [ ] test-zlib-brotli-16GB.js
Expand All @@ -705,7 +726,7 @@ export const closeAfterError = {
// - [ ] test-zlib-deflate-raw-inherits.js
// - [ ] test-zlib-flush-write-sync-interleaved.js
// - [ ] test-zlib-no-stream.js
// - [ ] test-zlib-write-after-close.js
// - [x] test-zlib-write-after-close.js
// - [ ] test-zlib-brotli-kmaxlength-rangeerror.js
// - [x] test-zlib-destroy.js
// - [ ] test-zlib-from-concatenated-gzip.js
Expand Down

0 comments on commit e262f5e

Please sign in to comment.