From d15b1c44460be7afbcd9159f5089a6228c1e6e86 Mon Sep 17 00:00:00 2001 From: Zahidul Islam Date: Sat, 22 Apr 2017 12:48:30 -0700 Subject: [PATCH] test: add mustCall in test-timers-clearImmediate PR-URL: https://github.com/nodejs/node/pull/12598 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-timers-clearImmediate.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/test/parallel/test-timers-clearImmediate.js b/test/parallel/test-timers-clearImmediate.js index c49fd7622f4ab6..ccd9826bb0c725 100644 --- a/test/parallel/test-timers-clearImmediate.js +++ b/test/parallel/test-timers-clearImmediate.js @@ -1,18 +1,13 @@ 'use strict'; -require('../common'); -const assert = require('assert'); +const common = require('../common'); const N = 3; -let count = 0; + function next() { - const immediate = setImmediate(function() { - clearImmediate(immediate); - ++count; - }); + const fn = common.mustCall(() => clearImmediate(immediate)); + const immediate = setImmediate(fn); } -for (let i = 0; i < N; ++i) - next(); -process.on('exit', () => { - assert.strictEqual(count, N, `Expected ${N} immediate callback executions`); -}); +for (let i = 0; i < N; i++) { + next(); +}