0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-util-deprecate-invalid-code.js
Ashish Kaila fe8297ca92
util: expand test coverage for util.deprecate
Test for invalid argument types passed to code on util.deprecate.

PR-URL: https://github.com/nodejs/node/pull/16305
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-10-22 11:31:21 -04:00

13 lines
336 B
JavaScript

'use strict';
const common = require('../common');
const util = require('util');
[1, true, false, null, {}].forEach((notString) => {
common.expectsError(() => util.deprecate(() => {}, 'message', notString), {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "code" argument must be of type string'
});
});