Jhernandez has uploaded a new change for review.

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

Change subject: Test WikiGrokResponseApi.js
......................................................................

Test WikiGrokResponseApi.js

Change-Id: I87d83a3ab959be1ec43e8a591b99ca169168226d
---
A tests/qunit/modules/wikigrok/test_WikiGrokResponseApi.js
1 file changed, 35 insertions(+), 0 deletions(-)


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

diff --git a/tests/qunit/modules/wikigrok/test_WikiGrokResponseApi.js 
b/tests/qunit/modules/wikigrok/test_WikiGrokResponseApi.js
new file mode 100644
index 0000000..83f1cf8
--- /dev/null
+++ b/tests/qunit/modules/wikigrok/test_WikiGrokResponseApi.js
@@ -0,0 +1,35 @@
+( function ( $, M ) {
+
+       var WikiGrokResponseApi = M.require( 
'modules/wikigrok/WikiGrokResponseApi' ),
+               Api = M.require( 'api' ).Api;
+
+       QUnit.module( 'MobileFrontend: WikiGrokResponseApi.js', {
+               setup: function () {
+                       this.api = new WikiGrokResponseApi( {
+                               itemId: 'Q764812',
+                               subject: 'title',
+                               version: 'a',
+                               userToken: 'token',
+                               taskToken: 'taskToken'
+                       } );
+
+                       this.spy = this.sandbox.stub( Api.prototype, 
'postWithToken' );
+               }
+       } );
+
+       QUnit.test( 'recordClaims', 8, function ( assert ) {
+               var callArgs,
+                       claims = [ { a: 1 }, { b: 2 } ];
+               this.api.recordClaims(claims);
+               assert.ok( this.spy.called );
+               callArgs = this.spy.getCall( 0 ).args;
+               assert.strictEqual( callArgs[0], 'edit');
+               assert.strictEqual( callArgs[1].action, 'wikigrokresponse' );
+               assert.strictEqual( callArgs[1].claims, JSON.stringify(claims) 
);
+               assert.strictEqual( callArgs[1].subject_id, 'Q764812' );
+               assert.strictEqual( callArgs[1].subject, 'title' );
+               assert.strictEqual( callArgs[1].user_token, 'token' );
+               assert.strictEqual( callArgs[1].task_token, 'taskToken' );
+       } );
+
+}( jQuery, mw.mobileFrontend ) );

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

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

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

Reply via email to