2 QUnit.module( 'mediawiki.api.category', QUnit.newMwEnvironment( {
4 this.server = this.sandbox.useFakeServer();
5 this.server.respondImmediately = true;
9 QUnit.test( '.getCategoriesByPrefix()', 1, function ( assert ) {
10 this.server.respondWith( [ 200, { 'Content-Type': 'application/json' },
11 '{ "query": { "allpages": [ ' +
12 '{ "title": "Category:Food" },' +
13 '{ "title": "Category:Fool Supermarine S.6" },' +
14 '{ "title": "Category:Fools" }' +
18 return new mw.Api().getCategoriesByPrefix( 'Foo' ).then( function ( matches ) {
21 [ 'Food', 'Fool Supermarine S.6', 'Fools' ]