79bd73065400867c5d82d57d503802ef1609c87b
1 QUnit
.module( 'mediawiki.api', QUnit
.newMwEnvironment() );
3 QUnit
.asyncTest( 'Basic functionality', function ( assert
) {
10 .done( function ( data
) {
11 assert
.deepEqual( data
, [], 'If request succeeds without errors, resolve deferred' );
17 .fail( function ( errorCode
, details
) {
18 assert
.equal( errorCode
, 'unknown_action', 'API error (e.g. "unknown_action") should reject the deferred' );
22 .done( function ( data
) {
23 assert
.deepEqual( data
, [], 'Simple POST request' );
26 // After all are completed, continue the test suite.
27 QUnit
.whenPromisesComplete( d1
, d2
, d3
).always( function () {
32 QUnit
.asyncTest( 'Deprecated callback methods', function ( assert
) {
38 d1
= api
.get( {}, function () {
39 assert
.ok( true, 'Function argument treated as success callback.' );
43 ok: function ( data
) {
44 assert
.ok( true, '"ok" property treated as success callback.' );
51 err: function ( data
) {
52 assert
.ok( true, '"err" property treated as error callback.' );
56 QUnit
.whenPromisesComplete( d1
, d2
, d3
).always( function () {