2 QUnit
.module( 'mediawiki.api', QUnit
.newMwEnvironment() );
4 QUnit
.asyncTest( 'Basic functionality', function ( assert
) {
11 .done( function ( data
) {
12 assert
.deepEqual( data
, [], 'If request succeeds without errors, resolve deferred' );
18 .fail( function ( errorCode
) {
19 assert
.equal( errorCode
, 'unknown_action', 'API error (e.g. "unknown_action") should reject the deferred' );
23 .done( function ( data
) {
24 assert
.deepEqual( data
, [], 'Simple POST request' );
27 // After all are completed, continue the test suite.
28 QUnit
.whenPromisesComplete( d1
, d2
, d3
).always( function () {
33 QUnit
.asyncTest( 'Deprecated callback methods', function ( assert
) {
39 d1
= api
.get( {}, function () {
40 assert
.ok( true, 'Function argument treated as success callback.' );
45 assert
.ok( true, '"ok" property treated as success callback.' );
53 assert
.ok( true, '"err" property treated as error callback.' );
57 QUnit
.whenPromisesComplete( d1
, d2
, d3
).always( function () {