UNPKG

@sprucelabs/test-utils

Version:

Helpful utilities to make asserting more complicated conditions quick and easy! ⚡️

26 lines (25 loc) 747 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Spy_1 = __importDefault(require("./Spy")); class Spier { static Spier() { for (const spy of Spier.spyInstances) { spy.reset(); } Spier.spyInstances = []; return new Spier(); } spy(object, method) { if (!object) { throw new Error('You must pass a function to spy on'); } const spy = new Spy_1.default(object, method); Spier.spyInstances.push(spy); return spy; } } Spier.spyInstances = []; exports.default = Spier;