• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2require('../common');
3const assert = require('assert');
4
5// This test ensures that the assert.CallTracker.report() works as intended.
6
7const tracker = new assert.CallTracker();
8
9function foo() {}
10
11const callsfoo = tracker.calls(foo, 1);
12
13// Ensures that foo was added to the callChecks array.
14assert.strictEqual(tracker.report()[0].operator, 'foo');
15
16callsfoo();
17
18// Ensures that foo was removed from the callChecks array after being called the
19// expected number of times.
20assert.strictEqual(typeof tracker.report()[0], 'undefined');
21
22callsfoo();
23
24// Ensures that foo was added back to the callChecks array after being called
25// more than the expected number of times.
26assert.strictEqual(tracker.report()[0].operator, 'foo');
27