2017-03-07 00:27:38 +00:00
|
|
|
var stubs = require( './stubs' ),
|
|
|
|
statsv = require( '../../src/statsvInstrumentation' );
|
|
|
|
|
|
|
|
QUnit.module( 'ext.popups/statsvInstrumentation', {
|
2017-04-25 15:10:11 +00:00
|
|
|
beforeEach: function () {
|
2017-03-07 00:27:38 +00:00
|
|
|
this.user = stubs.createStubUser();
|
|
|
|
this.config = stubs.createStubMap();
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
QUnit.test( 'isEnabled', function ( assert ) {
|
2017-04-25 12:12:36 +00:00
|
|
|
var experiments = stubs.createStubExperiments( true );
|
2017-03-07 00:27:38 +00:00
|
|
|
|
2017-04-25 12:12:36 +00:00
|
|
|
assert.expect( 2 );
|
2017-03-07 00:27:38 +00:00
|
|
|
|
|
|
|
assert.ok(
|
|
|
|
statsv.isEnabled( this.user, this.config, experiments ),
|
2017-04-25 12:12:36 +00:00
|
|
|
'Logging is enabled when the user is in the sample.'
|
2017-03-07 00:27:38 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
experiments = stubs.createStubExperiments( false );
|
|
|
|
|
|
|
|
assert.notOk(
|
|
|
|
statsv.isEnabled( this.user, this.config, experiments ),
|
2017-04-25 12:12:36 +00:00
|
|
|
'Logging is disabled when the user is not in the sample.'
|
2017-03-07 00:27:38 +00:00
|
|
|
);
|
|
|
|
} );
|