From ef2b25088d0924343c9d09fcf516cb17fab6e1a8 Mon Sep 17 00:00:00 2001 From: ZiJian Liu Date: Sat, 2 Jan 2021 12:40:02 +0800 Subject: [PATCH] test: increase coverage for assert/calltracker 1. test calls fn parameter is number Refs: https://coverage.nodejs.org/coverage-51b43675067fafaa/lib/internal/assert/calltracker.js.html#L30 2. test calls fn parameter is undefined Refs: https://coverage.nodejs.org/coverage-51b43675067fafaa/lib/internal/assert/calltracker.js.html#L33 PR-URL: https://github.com/nodejs/node/pull/36728 Reviewed-By: Rich Trott --- test/parallel/test-assert-calltracker-calls.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/parallel/test-assert-calltracker-calls.js b/test/parallel/test-assert-calltracker-calls.js index 4de23d4658468a..99db4ee284be81 100644 --- a/test/parallel/test-assert-calltracker-calls.js +++ b/test/parallel/test-assert-calltracker-calls.js @@ -64,3 +64,17 @@ assert.throws( () => callsfunc(), { message: msg } ); + +{ + const tracker = new assert.CallTracker(); + const callsNoop = tracker.calls(1); + callsNoop(); + tracker.verify(); +} + +{ + const tracker = new assert.CallTracker(); + const callsNoop = tracker.calls(undefined, 1); + callsNoop(); + tracker.verify(); +}