Properties
globalEventCount :numberconstant
#
The number of events that have been sent by all stubbed experiments.
Methods
restore()
#
Restores mw.testKitchen.getInstrument to its original state.
This method should be called after every unit test that calls
mw.testKitchen.useFakeInstruments.
Restores
mw.testKitchen.getInstrument to its original state.
stubInstrument(instrumentName) → {mw.testKitchen.StubbedInstrumentInterface}
#
Stubs an instrument.
Example
const tk = mw.testKitchen.useFakeExperiments();
const e = tk.stubInstrument( 'my-awesome-instrument' );
// Run Code Under Test
assert.strictEqual( e.eventCount, 1 );
assert.strictEqual( e.events[ 0 ].action, 'my-awesome-action' );
assert.strictEqual( tk.globalEventCount, 1 );
Parameters:
| Name | Type | Description |
|---|---|---|
instrumentName |
string |
Returns:
Stubs an instrument.