diff --git a/Gruntfile.js b/Gruntfile.js index ef00b2803..0e8d091c6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -24,6 +24,7 @@ module.exports = function ( grunt ) { 'src/**', 'resources/ext.popups/*.js', 'resources/ext.popups/**/*.js', + 'tests/node-qunit/**/*.js', '!resources/dist/index.js', '!docs/**', '!node_modules/**' diff --git a/tests/node-qunit/actions.test.js b/tests/node-qunit/actions.test.js index e12b054c0..2d7a6e62e 100644 --- a/tests/node-qunit/actions.test.js +++ b/tests/node-qunit/actions.test.js @@ -324,7 +324,7 @@ QUnit.test( 'it should dispatch the FETCH_END action when the API request ends', this.gatewayPromise.then( function () { assert.deepEqual( - that.dispatch.getCall( 1 ).args[0], + that.dispatch.getCall( 1 ).args[ 0 ], { type: 'FETCH_END', el: that.el, @@ -343,7 +343,7 @@ QUnit.test( 'it should delay dispatching the FETCH_COMPLETE action', function ( result = {}, that = this, done = assert.async(); - + whenSpy = this.sandbox.stub( $, 'when' ) .returns( whenDeferred.promise() ); @@ -360,7 +360,7 @@ QUnit.test( 'it should delay dispatching the FETCH_COMPLETE action', function ( // This assertion is disabled due to $.Promise#then and #fail returning a new // instance of $.Promise. - //assert.strictEqual( args[ 0 ], this.gatewayPromise ); + // assert.strictEqual( args[ 0 ], this.gatewayPromise ); assert.strictEqual( args[ 1 ], this.waitPromises[ 0 ] ); diff --git a/tests/node-qunit/changeListeners/statsv.test.js b/tests/node-qunit/changeListeners/statsv.test.js index 24b426b19..349996133 100644 --- a/tests/node-qunit/changeListeners/statsv.test.js +++ b/tests/node-qunit/changeListeners/statsv.test.js @@ -83,4 +83,3 @@ QUnit.test( 'it should not log when no action is given', function ( assert ) { 'The statsvLoggged bound action is not called when no action is given.' ); } ); - diff --git a/tests/node-qunit/gateway/rest.test.js b/tests/node-qunit/gateway/rest.test.js index 83f832133..a864f8d1c 100644 --- a/tests/node-qunit/gateway/rest.test.js +++ b/tests/node-qunit/gateway/rest.test.js @@ -57,40 +57,40 @@ var createModel = require( '../../../src/preview/model' ).createModel, // See https://phabricator.wikimedia.org/T158632#3071104 onward for additional // context. RESTBASE_RESPONSE_WITH_SMALL_IMAGE = { - title: "PreviewsNonFreeImage/sandbox", - extract: "Hello, I am the non-free image and parenthetical page (YOU CAN'T SEE THIS). My preview should contain an image that is not free. My preview should contain a parenthetical you cannot see..", + title: 'PreviewsNonFreeImage/sandbox', + extract: 'Hello, I am the non-free image and parenthetical page (YOU CAN\'T SEE THIS). My preview should contain an image that is not free. My preview should contain a parenthetical you cannot see..', thumbnail: { - source: "https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png", + source: 'https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png', width: 300, height: 126, - original: "https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png" + original: 'https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png' }, originalimage: { - source: "https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png", + source: 'https://upload.wikimedia.org/wikipedia/commons/2/2c/RH-Fedora_logo-nonfree.png', width: 300, height: 126 }, - lang: "en", - dir: "ltr", - timestamp: "2017-02-17T22:29:56Z" + lang: 'en', + dir: 'ltr', + timestamp: '2017-02-17T22:29:56Z' }, RESTBASE_RESPONSE_WITH_LANDSCAPE_IMAGE = { - title: "Landscape", - extract: "Landscape", + title: 'Landscape', + extract: 'Landscape', thumbnail: { - source: "http://foo/bar/baz.png/500px-baz.png", + source: 'http://foo/bar/baz.png/500px-baz.png', width: 500, height: 300, - original: "http://foo/bar/baz.png" + original: 'http://foo/bar/baz.png' }, originalimage: { - source: "http://foo/bar/baz.png", + source: 'http://foo/bar/baz.png', width: 1000, height: 600 }, - lang: "en", - dir: "ltr", - timestamp: "2017-02-17T22:29:56Z" + lang: 'en', + dir: 'ltr', + timestamp: '2017-02-17T22:29:56Z' }, RESTBASE_RESPONSE_PREVIEW_MODEL = createModel( 'Barack Obama', @@ -143,8 +143,7 @@ QUnit.test( 'RESTBase gateway is correctly converting the page data to a model ' QUnit.test( 'RESTBase gateway doesn\'t stretch thumbnails', function ( assert ) { var model, - gateway = createRESTBaseGateway(), - response; + gateway = createRESTBaseGateway(); model = gateway.convertPageToModel( RESTBASE_RESPONSE, 2000 ); diff --git a/tests/node-qunit/isEnabled.test.js b/tests/node-qunit/isEnabled.test.js index a427583ad..3b574ce68 100644 --- a/tests/node-qunit/isEnabled.test.js +++ b/tests/node-qunit/isEnabled.test.js @@ -14,7 +14,6 @@ function createStubUserSettings( isEnabled ) { }; } - QUnit.module( 'ext.popups#isEnabled (logged out)', { setup: function () { this.user = stubs.createStubUser( /* isAnon = */ true ); @@ -31,17 +30,17 @@ QUnit.test( 'is should handle logged out users', function ( assert ) { cases = [ [ undefined, true, true, 'When the user hasn\'t enabled or disabled' + - ' the feature and the user is in the sample.' ], + ' the feature and the user is in the sample.' ], [ undefined, false, false, 'When the user hasn\'t enabled or disabled' + - ' the feature and the user is not in the sample.' ], + ' the feature and the user is not in the sample.' ], [ false, true, false, 'When the user has disabled the feature' + - ' and the user is in the sample.'], + ' and the user is in the sample.' ], [ false, false, false, 'When the user has disabled the feature' + - ' and the user is not in the sample.'], + ' and the user is not in the sample.' ], [ true, true, true, 'When the user has enabled the feature' + - ' and the user is in the sample.' ], + ' and the user is in the sample.' ], [ true, false, true, 'When the user has enabled the feature' + - ' and the user is not in the sample.' ] + ' and the user is not in the sample.' ] ]; for ( i = 0; i < cases.length; i++ ) { diff --git a/tests/node-qunit/reducers/eventLogging.test.js b/tests/node-qunit/reducers/eventLogging.test.js index 7fabf2c25..e035d9e50 100644 --- a/tests/node-qunit/reducers/eventLogging.test.js +++ b/tests/node-qunit/reducers/eventLogging.test.js @@ -236,7 +236,7 @@ QUnit.test( state = eventLogging( state, { type: 'ABANDON_START', - timestamp: now + 250, + timestamp: now + 250 } ); state = eventLogging( state, { @@ -365,7 +365,7 @@ QUnit.test( 'FETCH_COMPLETE', function ( assert ) { initialState = { interaction: { token: token - }, + } }, state; @@ -421,8 +421,8 @@ QUnit.test( 'FETCH_COMPLETE', function ( assert ) { QUnit.test( 'ABANDON_START', function ( assert ) { var state = { - interaction: {} - }; + interaction: {} + }; state = eventLogging( state, { type: 'ABANDON_START', @@ -471,8 +471,8 @@ QUnit.test( 'ABANDON_END', function ( assert ) { QUnit.test( 'PREVIEW_DWELL', function ( assert ) { var state = { - interaction: {} - }; + interaction: {} + }; state = eventLogging( state, { type: 'PREVIEW_DWELL' @@ -522,7 +522,7 @@ QUnit.test( 'ABANDON_END should enqueue an event', function ( assert ) { state = eventLogging( state, { type: 'ABANDON_END', - token: token, + token: token } ); assert.deepEqual( @@ -557,7 +557,7 @@ QUnit.test( 'ABANDON_END should enqueue an event', function ( assert ) { state = eventLogging( state, { type: 'ABANDON_END', - token: token, + token: token } ); assert.deepEqual( diff --git a/tests/node-qunit/reducers/statsv.test.js b/tests/node-qunit/reducers/statsv.test.js index 04158f61a..2bbd09086 100644 --- a/tests/node-qunit/reducers/statsv.test.js +++ b/tests/node-qunit/reducers/statsv.test.js @@ -34,7 +34,7 @@ QUnit.test( 'FETCH_START', function ( assert ) { } ); QUnit.test( 'FETCH_END', function ( assert ) { - var startedAt, endedAt, delay, action, state; + var startedAt, endedAt, action, state; assert.expect( 1 ); @@ -42,7 +42,7 @@ QUnit.test( 'FETCH_END', function ( assert ) { endedAt = 500; action = { type: 'FETCH_END', - timestamp: endedAt, + timestamp: endedAt }; state = statsv( { fetchStartedAt: startedAt }, action ); @@ -136,4 +136,3 @@ QUnit.test( 'STATSV_LOGGED', function ( assert ) { } ); } ); - diff --git a/tests/node-qunit/statsvInstrumentation.test.js b/tests/node-qunit/statsvInstrumentation.test.js index b2f2fcac9..3e39d2b8c 100644 --- a/tests/node-qunit/statsvInstrumentation.test.js +++ b/tests/node-qunit/statsvInstrumentation.test.js @@ -9,20 +9,19 @@ QUnit.module( 'ext.popups/statsvInstrumentation', { } ); QUnit.test( 'isEnabled', function ( assert ) { - assert.expect( 2 ); + var experiments = stubs.createStubExperiments( true ); - var experiments = stubs.createStubExperiments( true ), - samplingRate; + assert.expect( 2 ); assert.ok( statsv.isEnabled( this.user, this.config, experiments ), - "Logging is enabled when the user is in the sample." + '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." + 'Logging is disabled when the user is not in the sample.' ); } );