Skip to content

Commit

Permalink
test createBrotliCompress error
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Sep 12, 2024
1 parent e2d40ae commit fe88b1a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/workerd/api/node/tests/zlib-nodejs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2605,3 +2605,25 @@ const PSS_VECTORS_JSON = `{
]
}
}`;

// Regression test for https://github.com/cloudflare/workerd/issues/2694
export const createBrotliCompressUnexpectedError = {
async test() {
const { promise, resolve } = Promise.withResolvers();
try {
zlib.createBrotliCompress({
params: {
// This is a boolean flag
[zlib.constants.BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING]: 42,
},
});

throw new Error('should have thrown an error');
} catch (error) {
assert.strictEqual(error.code, 'ERR_ZLIB_INITIALIZATION_FAILED');
resolve();
}

await promise;
},
};

0 comments on commit fe88b1a

Please # to comment.