jenkins-bot has submitted this change and it was merged.
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(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
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: merged
Gerrit-Change-Id: Iea8cdb4d116b344336b58808aa98cc5d97ce8321
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits