Added warning for improper ending of a token
[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 }
6 } ) );
7
8 QUnit.test( '.getCategoriesByPrefix()', function ( assert ) {
9 QUnit.expect( 1 );
10
11 var api = new mw.Api();
12
13 api.getCategoriesByPrefix( 'Foo' ).done( function ( matches ) {
14 assert.deepEqual(
15 matches,
16 [ 'Food', 'Fool Supermarine S.6', 'Fools' ]
17 );
18 } );
19
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 ) );