Page MenuHomeWickedGov Phorge

statsv.test.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

statsv.test.js

import statsv from '../../../src/changeListeners/statsv';
QUnit.module( 'ext.popups/changeListeners/statsv', {
beforeEach() {
this.boundActions = {
statsvLogged: this.sandbox.spy()
};
this.track = this.sandbox.spy();
}
} );
QUnit.test( 'it should log the queued event', function ( assert ) {
const newState = {
statsv: {
action: 'myAction',
data: 123
}
};
const changeListener = statsv( this.boundActions, this.track );
changeListener( undefined, newState );
assert.true(
this.track.calledWith( 'myAction', 123 ),
'It should track an action with data when logging is enabled.'
);
assert.true(
this.boundActions.statsvLogged.called,
'The statsvLoggged bound action is called once the event has been logged.'
);
} );
QUnit.test( 'it should not log when no action is given', function ( assert ) {
const newState = {
statsv: {
data: 123
}
};
const changeListener = statsv( this.boundActions, this.track );
changeListener( undefined, newState );
assert.true(
this.track.notCalled,
'No logging occurs when no action is given.'
);
assert.true(
this.boundActions.statsvLogged.notCalled,
'The statsvLoggged bound action is not called when no action is given.'
);
} );

File Metadata

Mime Type
text/x-java
Expires
Aug 19 2026, 18:09 (5 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8d/57/96c8a1b5ef8bbe40a36637b372e2
Default Alt Text
statsv.test.js (1 KB)

Event Timeline