Provides options for controlling how a Spy behaves when invoked.
Spy
Calls the specified method when the Spy is invoked.
import { spy } from '@paychex/core';const method = spy().invokes(function(...args) { console.log('method called with', args);});method.onCall(1).invokes(function(...args) { console.log('method called 2nd time', args);});
The original context, for chaining.
Returns the specified value when the Spy is invoked.
import { spy } from '@paychex/core';const method = spy().returns('abc');method.onCall(1).returns('def');
The value to return.
Throws the specified value when the Spy is invoked.
import { spy } from '@paychex/core';const method = spy().throws(new Error());method.onCall(1).throws(new Error('2nd call'));
Provides options for controlling how a Spy behaves when invoked.
Spy