summaryrefslogtreecommitdiff
path: root/test/parallel/test-whatwg-encoding-custom-textdecoder-invalid-arg.js
blob: a2b56ad9577271739a5e80b8c6766f6bec89f8b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'use strict';

// This tests that ERR_INVALID_ARG_TYPE are thrown when
// invalid arguments are passed to TextDecoder.

const common = require('../common');

{
  const notArrayBufferViewExamples = [false, {}, 1, '', new Error()];
  notArrayBufferViewExamples.forEach((invalidInputType) => {
    common.expectsError(() => {
      new TextDecoder(undefined, null).decode(invalidInputType);
    }, {
      code: 'ERR_INVALID_ARG_TYPE',
      type: TypeError
    });
  });
}