Skip to content
This repository has been archived by the owner on Aug 31, 2018. It is now read-only.

Commit

Permalink
util: expand test coverage for util.deprecate
Browse files Browse the repository at this point in the history
Test for invalid argument types passed to code on util.deprecate.

PR-URL: nodejs/node#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>
  • Loading branch information
akaila authored and addaleax committed Dec 7, 2017
1 parent 785500c commit 8f36bca
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/parallel/test-util-deprecate-invalid-code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'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'
});
});

0 comments on commit 8f36bca

Please sign in to comment.