@sprucelabs/test-utils
Version:
Helpful utilities to make asserting more complicated conditions quick and easy! ⚡️
21 lines (20 loc) • 497 B
JavaScript
import Spy from './Spy.js';
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(object, method);
Spier.spyInstances.push(spy);
return spy;
}
}
Spier.spyInstances = [];
export default Spier;