We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd9aefd commit eba9addCopy full SHA for eba9add
test/parallel/test-timer-close.js
@@ -1,16 +1,11 @@
1
'use strict';
2
-require('../common');
3
-const assert = require('assert');
+const common = require('../common');
4
5
-var t = new (process.binding('timer_wrap').Timer)();
6
-var called = 0;
7
-function onclose() {
8
- called++;
9
-}
+// Make sure handle._handle.close(callback) is idempotent by closing a timer
+// twice. The first function should be called, the second one should not.
10
11
-t.close(onclose);
12
+const Timer = process.binding('timer_wrap').Timer;
+const t = new Timer();
13
14
-process.on('exit', function() {
15
- assert.equal(1, called);
16
-});
+t.close(common.mustCall(function() {}));
+t.close(() => common.fail('This should never be called'));
0 commit comments