mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-18 21:05:57 +00:00
29 lines
721 B
JavaScript
29 lines
721 B
JavaScript
|
var stubs = require( './stubs' ),
|
||
|
statsv = require( '../../src/statsvInstrumentation' );
|
||
|
|
||
|
QUnit.module( 'ext.popups/statsvInstrumentation', {
|
||
|
setup: function () {
|
||
|
this.user = stubs.createStubUser();
|
||
|
this.config = stubs.createStubMap();
|
||
|
}
|
||
|
} );
|
||
|
|
||
|
QUnit.test( 'isEnabled', function ( assert ) {
|
||
|
assert.expect( 2 );
|
||
|
|
||
|
var experiments = stubs.createStubExperiments( true ),
|
||
|
samplingRate;
|
||
|
|
||
|
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."
|
||
|
);
|
||
|
} );
|