• 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.
14if (tracker.report()[0].operator !== 'foo') {
15  process.exit(1);
16}
17
18callsfoo();
19
20// Ensures that foo was removed from the callChecks array after being called the
21// expected number of times.
22if (typeof tracker.report()[0] === undefined) {
23  process.exit(1);
24}
25
26callsfoo();
27
28// Ensures that foo was added back to the callChecks array after being called
29// more than the expected number of times.
30if (tracker.report()[0].operator !== 'foo') {
31  process.exit(1);
32}
33