mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-01 02:36:35 +00:00
698a93f5bc
The setup and teardown hooks on QUnit.module are deprecated on the latest versions. See https://api.qunitjs.com/QUnit/module mw-node-qunit supports them but we shouldn't be using them. Bug: T160406 Change-Id: I32c07f22d01d16449a6e37f46ff20c577a1f14c6
28 lines
710 B
JavaScript
28 lines
710 B
JavaScript
var stubs = require( './stubs' ),
|
|
statsv = require( '../../src/statsvInstrumentation' );
|
|
|
|
QUnit.module( 'ext.popups/statsvInstrumentation', {
|
|
beforeEach: function () {
|
|
this.user = stubs.createStubUser();
|
|
this.config = stubs.createStubMap();
|
|
}
|
|
} );
|
|
|
|
QUnit.test( 'isEnabled', function ( assert ) {
|
|
var experiments = stubs.createStubExperiments( true );
|
|
|
|
assert.expect( 2 );
|
|
|
|
assert.ok(
|
|
statsv.isEnabled( this.user, this.config, experiments ),
|
|
'Logging is enabled when the user is in the sample.'
|
|
);
|
|
|
|
experiments = stubs.createStubExperiments( false );
|
|
|
|
assert.notOk(
|
|
statsv.isEnabled( this.user, this.config, experiments ),
|
|
'Logging is disabled when the user is not in the sample.'
|
|
);
|
|
} );
|