Merge "Added release notes for 'ContentHandler::runLegacyHooks' removal"
[mediawiki.git] / tests / qunit / suites / resources / mediawiki.api / mediawiki.api.messages.test.js
blobd8b5db88a366e0edc80ab7ba3ba3609f35f5da11
1 ( function ( mw ) {
2         QUnit.module( 'mediawiki.api.messages', QUnit.newMwEnvironment( {
3                 setup: function () {
4                         this.server = this.sandbox.useFakeServer();
5                         this.server.respondImmediately = true;
6                 }
7         } ) );
9         QUnit.test( '.getMessages()', 1, function ( assert ) {
10                 this.server.respondWith( /ammessages=foo%7Cbaz/, [
11                         200,
12                         { 'Content-Type': 'application/json' },
13                         '{ "query": { "allmessages": [' +
14                                 '{ "name": "foo", "content": "Foo bar" },' +
15                                 '{ "name": "baz", "content": "Baz Quux" }' +
16                                 '] } }'
17                 ] );
19                 return new mw.Api().getMessages( [ 'foo', 'baz' ] ).then( function ( messages ) {
20                         assert.deepEqual(
21                                 messages,
22                                 {
23                                         foo: 'Foo bar',
24                                         baz: 'Baz Quux'
25                                 }
26                         );
27                 } );
28         } );
29 }( mediaWiki ) );