Import: Handle uploads with sha1 starting with 0 properly
[mediawiki.git] / tests / qunit / suites / resources / mediawiki.api / mediawiki.api.messages.test.js
blob5880962a74e40572eefd161c36efa293898c7a20
1 ( function ( mw ) {
2         QUnit.module( 'mediawiki.api.messages', QUnit.newMwEnvironment( {
3                 setup: function () {
4                         this.server = this.sandbox.useFakeServer();
5                 }
6         } ) );
8         QUnit.test( '.getMessages()', function ( assert ) {
9                 QUnit.expect( 1 );
11                 var api = new mw.Api();
12                 api.getMessages( [ 'foo', 'baz' ] ).then( function ( messages ) {
13                         assert.deepEqual(
14                                 messages,
15                                 {
16                                         foo: 'Foo bar',
17                                         baz: 'Baz Quux'
18                                 }
19                         );
20                 } );
22                 this.server.respond( /ammessages=foo%7Cbaz/, [
23                         200,
24                         { 'Content-Type': 'application/json' },
25                         '{ "query": { "allmessages": [' +
26                                 '{ "name": "foo", "content": "Foo bar" },' +
27                                 '{ "name": "baz", "content": "Baz Quux" }' +
28                                 '] } }'
29                 ] );
30         } );
31 }( mediaWiki ) );