From d1da89906d5e3328c7a98fff55cfcc843f6ed865 Mon Sep 17 00:00:00 2001 From: lrlna Date: Thu, 1 Dec 2016 12:04:27 -0600 Subject: [PATCH] test: increase coverage for timers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a test for cancelling timers with null or no arguments. PR-URL: https://github.com/nodejs/node/pull/10068 Reviewed-By: Myles Borins Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Jeremiah Senkpiel Reviewed-By: Michaƫl Zasso Reviewed-By: Roman Reiss --- ...t-timers-clear-null-does-not-throw-error.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/parallel/test-timers-clear-null-does-not-throw-error.js diff --git a/test/parallel/test-timers-clear-null-does-not-throw-error.js b/test/parallel/test-timers-clear-null-does-not-throw-error.js new file mode 100644 index 00000000000000..a15072a4c63f46 --- /dev/null +++ b/test/parallel/test-timers-clear-null-does-not-throw-error.js @@ -0,0 +1,18 @@ +'use strict'; +require('../common'); +const assert = require('assert'); + +// This test makes sure clearing timers with +// 'null' or no input does not throw error + +assert.doesNotThrow(() => clearInterval(null)); + +assert.doesNotThrow(() => clearInterval()); + +assert.doesNotThrow(() => clearTimeout(null)); + +assert.doesNotThrow(() => clearTimeout()); + +assert.doesNotThrow(() => clearImmediate(null)); + +assert.doesNotThrow(() => clearImmediate());