Skip to main content
assert.CallTracker.prototype.verify - assert - Node documentation
method assert.CallTracker.prototype.verify

Usage in Deno

import assert from "node:assert";
CallTracker.prototype.verify(): void

Iterates through the list of functions passed to tracker.calls() and will throw an error for functions that have not been called the expected number of times.

import assert from 'node:assert';

// Creates call tracker.
const tracker = new assert.CallTracker();

function func() {}

// Returns a function that wraps func() that must be called exact times
// before tracker.verify().
const callsfunc = tracker.calls(func, 2);

callsfunc();

// Will throw an error since callsfunc() was only called once.
tracker.verify();

Return Type

void