We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d66d4fc commit f686f73Copy full SHA for f686f73
test/parallel/test-async-wrap-asyncresource-constructor.js
@@ -0,0 +1,23 @@
1
+'use strict';
2
+require('../common');
3
+
4
+// This tests that AsyncResource throws an error if bad parameters are passed
5
6
+const assert = require('assert');
7
+const AsyncResource = require('async_hooks').AsyncResource;
8
9
+assert.throws(() => {
10
+ return new AsyncResource();
11
+}, /^TypeError: type must be a string with length > 0$/);
12
13
14
+ new AsyncResource('');
15
16
17
18
+ new AsyncResource('type', -4);
19
+}, /^RangeError: triggerId must be an unsigned integer$/);
20
21
22
+ new AsyncResource('type', Math.PI);
23
0 commit comments