From fd5af6bfa9023b90231a51498f221f4646bd3589 Mon Sep 17 00:00:00 2001 From: timothy searcy Date: Thu, 29 Nov 2018 19:01:09 -0800 Subject: [PATCH] test: check invalid argument error for option This commit adds a test for the validateArguments function in TextDecoder. PR-URL: https://github.com/nodejs/node/pull/24736 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- test/parallel/test-whatwg-encoding-textdecoder.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/parallel/test-whatwg-encoding-textdecoder.js b/test/parallel/test-whatwg-encoding-textdecoder.js index 531368f0b731d2..9d8ae335f1497f 100644 --- a/test/parallel/test-whatwg-encoding-textdecoder.js +++ b/test/parallel/test-whatwg-encoding-textdecoder.js @@ -234,6 +234,16 @@ testDecodeSample( ] ); +{ + common.expectsError( + () => new TextDecoder('utf-8', 1), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + } + ); +} + // From: https://github.com/w3c/web-platform-tests/blob/master/encoding/api-invalid-label.html [ 'utf-8',