Merge "Rank aliases in search in order they appear in the messages file."
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki.api / mediawiki.api.category.test.js
1 ( function ( mw ) {
2 QUnit.module( 'mediawiki.api.category', QUnit.newMwEnvironment( {
3 setup: function () {
4 this.server = this.sandbox.useFakeServer();
5 this.server.respondImmediately = true;
6 }
7 } ) );
8
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" }' +
15 '] } }'
16 ] );
17
18 return new mw.Api().getCategoriesByPrefix( 'Foo' ).then( function ( matches ) {
19 assert.deepEqual(
20 matches,
21 [ 'Food', 'Fool Supermarine S.6', 'Fools' ]
22 );
23 } );
24 } );
25 }( mediaWiki ) );