AndyRussG has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/181128

Change subject: Test fixtures: move defaults to shared json
......................................................................

Test fixtures: move defaults to shared json

Change-Id: Iea4aca6e341720faf391968aa9b6d522df3cf902
---
M tests/data/AllocationsFixtures.json
M 
tests/qunit/ext.centralNotice.bannerController.lib/bannerController.lib.tests.js
2 files changed, 23 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice 
refs/changes/28/181128/1

diff --git a/tests/data/AllocationsFixtures.json 
b/tests/data/AllocationsFixtures.json
index 6e239d6..bb00007 100644
--- a/tests/data/AllocationsFixtures.json
+++ b/tests/data/AllocationsFixtures.json
@@ -1,4 +1,23 @@
 {
+    "defaults": {
+        "setup": {
+            "campaigns": {
+                "banners": [],
+                "bucket_count": 1,
+                "countries": [],
+                "geotargeted": 0,
+                "preferred": 1,
+                "throttle": 100
+            },
+            "banners": {
+                "bucket": 0,
+                "devices": [ "desktop" ],
+                "weight": 25,
+                "display_anon": true,
+                "display_account": true
+            }
+        }
+    },
     "testCases": {
         "completeness": {
             "setup": {
diff --git 
a/tests/qunit/ext.centralNotice.bannerController.lib/bannerController.lib.tests.js
 
b/tests/qunit/ext.centralNotice.bannerController.lib/bannerController.lib.tests.js
index a18b257..6ae0072 100644
--- 
a/tests/qunit/ext.centralNotice.bannerController.lib/bannerController.lib.tests.js
+++ 
b/tests/qunit/ext.centralNotice.bannerController.lib/bannerController.lib.tests.js
@@ -1,21 +1,6 @@
 ( function( mw, $ ) {
        'use strict';
 
-       var defaultCampaignData = {
-               banners: [],
-               bucket_count: 1,
-               countries: [],
-               geotargeted: 0,
-               preferred: 1,
-               throttle: 100
-       }, defaultBannerData = {
-               bucket: 0,
-               devices: [ 'desktop' ],
-               weight: 25,
-               display_anon: true,
-               display_account: true
-       };
-
        QUnit.module( 'ext.centralNotice.bannerController.lib', 
QUnit.newMwEnvironment( {
                setup: function() {
                        mw.centralNotice.data.country = 'XX';
@@ -28,6 +13,8 @@
 
                var testFixtures = mw.centralNoticeTestFixtures,
                        testCases = testFixtures.testCases,
+                       defaultCampaignSetup = 
testFixtures.defaults.setup.campaigns,
+                       defaultBannerSetup = 
testFixtures.defaults.setup.banners,
                        lib = mw.cnBannerControllerLib;
 
                QUnit.expect( Object.keys( testCases ).length );
@@ -43,11 +30,11 @@
                        choices = $.map( testCase.choices, function( campaign ) 
{
                                return $.extend(
                                        { },
-                                       defaultCampaignData,
+                                       defaultCampaignSetup,
                                        campaign,
                                        {
                                                banners: $.map( 
campaign.banners, function( banner ) {
-                                                       return $.extend( {}, 
defaultBannerData, banner );
+                                                       return $.extend( {}, 
defaultBannerSetup, banner );
                                                } )
                                        } );
                        } );

-- 
To view, visit https://gerrit.wikimedia.org/r/181128
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea4aca6e341720faf391968aa9b6d522df3cf902
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: AndyRussG <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to