Skip to content

Commit 29641c8

Browse files
ChatbotSchoolevanlucas
authored andcommitted
test: add mustCall in test-timers-clearImmediate
PR-URL: #12598 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 47faa02 commit 29641c8

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed
+7-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
'use strict';
2-
require('../common');
3-
const assert = require('assert');
2+
const common = require('../common');
43

54
const N = 3;
6-
let count = 0;
5+
76
function next() {
8-
const immediate = setImmediate(function() {
9-
clearImmediate(immediate);
10-
++count;
11-
});
7+
const fn = common.mustCall(() => clearImmediate(immediate));
8+
const immediate = setImmediate(fn);
129
}
13-
for (let i = 0; i < N; ++i)
14-
next();
1510

16-
process.on('exit', () => {
17-
assert.strictEqual(count, N, `Expected ${N} immediate callback executions`);
18-
});
11+
for (let i = 0; i < N; i++) {
12+
next();
13+
}

0 commit comments

Comments
 (0)