summaryrefslogtreecommitdiff
path: root/test/parallel/test-buffer-bad-overload.js
blob: 63acb8ebfb6d4926145e8e667cb90e9e70129d04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';
const common = require('../common');
const assert = require('assert');

Buffer.allocUnsafe(10); // Should not throw.

const err = common.expectsError({
  code: 'ERR_INVALID_ARG_TYPE',
  type: TypeError,
  message: 'The "value" argument must not be of type number. ' +
           'Received type number'
});
assert.throws(function() {
  Buffer.from(10, 'hex');
}, err);

Buffer.from('deadbeaf', 'hex'); // Should not throw.