2 QUnit.module( 'mediawiki.api.category', QUnit.newMwEnvironment( {
4 this.server = this.sandbox.useFakeServer();
8 QUnit.test( '.getCategoriesByPrefix()', function ( assert ) {
11 var api = new mw.Api();
13 api.getCategoriesByPrefix( 'Foo' ).done( function ( matches ) {
16 [ 'Food', 'Fool Supermarine S.6', 'Fools' ]
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" }' +