diff --git a/test/parallel/test-tls-ticket-invalid-arg.js b/test/parallel/test-tls-ticket-invalid-arg.js index 4a430d3b00b7b8..55143cdca31e77 100644 --- a/test/parallel/test-tls-ticket-invalid-arg.js +++ b/test/parallel/test-tls-ticket-invalid-arg.js @@ -7,16 +7,18 @@ if (!common.hasCrypto) { const assert = require('assert'); const tls = require('tls'); -[null, undefined, 0, 1, 1n, Symbol(), {}, [], true, false, ''].forEach( - (arg) => - assert.throws(() => { - new tls.Server().setTicketKeys(arg); - }, /"buffer" argument must be an instance of Buffer, TypedArray, or DataView/) -); +const server = new tls.Server(); + +[null, undefined, 0, 1, 1n, Symbol(), {}, [], true, false, '', () => {}] + .forEach((arg) => + assert.throws( + () => server.setTicketKeys(arg), + { code: 'ERR_INVALID_ARG_TYPE' } + )); [new Uint8Array(1), Buffer.from([1]), new DataView(new ArrayBuffer(2))].forEach( (arg) => assert.throws(() => { - new tls.Server().setTicketKeys(arg); + server.setTicketKeys(arg); }, /Session ticket keys must be a 48-byte buffer/) );