mediawiki-extensions-Popups/tests/node-qunit/statsvInstrumentation.test.js

29 lines
721 B
JavaScript
Raw Normal View History

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."
);
} );