Florianschmidtwelzow has uploaded a new change for review.

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

Change subject: Hygiene: Stub all Api calls in qunit test
......................................................................

Hygiene: Stub all Api calls in qunit test

Tests should never make a call to Api.

Change-Id: Iea8cdb4d116b344336b58808aa98cc5d97ce8321
---
M tests/qunit/test_InfiniteScroll.js
1 file changed, 27 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/60/198660/1

diff --git a/tests/qunit/test_InfiniteScroll.js 
b/tests/qunit/test_InfiniteScroll.js
index fd115fe..d4ba7e3 100644
--- a/tests/qunit/test_InfiniteScroll.js
+++ b/tests/qunit/test_InfiniteScroll.js
@@ -1,8 +1,33 @@
 ( function ( M, $ ) {
-       var InfiniteScroll = M.require( 'InfiniteScroll' );
+       var InfiniteScroll = M.require( 'InfiniteScroll' ),
+               WatchListApi = M.require( 'modules/watchlist/WatchListApi' ),
+               response = {
+                       'query-continue': {
+                               pageimages: {
+                                       picontinue: 9
+                               }
+                       },
+                       query: {
+                               pages: {
+                                       2: {
+                                               pageid: 2,
+                                               ns: 0,
+                                               title: 'Burrito',
+                                               contentmodel: 'wikitext',
+                                               pagelanguage: 'en',
+                                               touched: '2014-12-17T10:06:49Z',
+                                               lastrevid: 552,
+                                               length: 33534
+                                       }
+                               }
+                       }
+               };
 
        QUnit.module( 'MobileFrontend InfiniteScroll', {
-               setup: function () {},
+               setup: function () {
+                       this.sandbox.stub( WatchListApi.prototype, 'get' )
+                               .returns( $.Deferred().resolve( response ) );
+               },
                teardown: function () {
                        // Remove all scroll events after each test
                        $( window ).off( 'scroll' );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea8cdb4d116b344336b58808aa98cc5d97ce8321
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>

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

Reply via email to