Skip to content

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: #16305
Backport-PR-URL: #16430
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 gibfahn committed Oct 30, 2017
1 parent d222c65 commit 908ba41
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/parallel/test-util-deprecate-invalid-code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

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

[1, true, false, null, {}].forEach((notString) => {
common.expectsError(() => util.deprecate(() => {}, 'message', notString), {
type: TypeError,
message: '`code` argument must be a string'
});
});

0 comments on commit 908ba41

Please sign in to comment.