Implement extension registration from an extension.json file
[mediawiki.git] / tests / qunit / suites / resources / mediawiki.api / mediawiki.api.category.test.js
bloba0c7daf1a066ca720090a5b9f5f6aa26411873cd
1 ( function ( mw ) {
2         QUnit.module( 'mediawiki.api.category', QUnit.newMwEnvironment( {
3                 setup: function () {
4                         this.server = this.sandbox.useFakeServer();
5                 }
6         } ) );
8         QUnit.test( '.getCategoriesByPrefix()', function ( assert ) {
9                 QUnit.expect( 1 );
11                 var api = new mw.Api();
13                 api.getCategoriesByPrefix( 'Foo' ).done( function ( matches ) {
14                         assert.deepEqual(
15                                 matches,
16                                 [ 'Food', 'Fool Supermarine S.6', 'Fools' ]
17                         );
18                 } );
20                 this.server.respond( function ( req ) {
21                         req.respond( 200, { 'Content-Type': 'application/json' },
22                                 '{ "query": { "allpages": [ ' +
23                                         '{ "title": "Category:Food" },' +
24                                         '{ "title": "Category:Fool Supermarine S.6" },' +
25                                         '{ "title": "Category:Fools" }' +
26                                         '] } }'
27                         );
28                 } );
29         } );
30 }( mediaWiki ) );