blob: 7282b3fbe0c07012a5fd8380377b26a847086bf7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
( function ( mw ) {
QUnit.module( 'mediawiki.api.messages', QUnit.newMwEnvironment( {
setup: function () {
this.server = this.sandbox.useFakeServer();
this.server.respondImmediately = true;
}
} ) );
QUnit.test( '.getMessages()', function ( assert ) {
this.server.respondWith( /ammessages=foo%7Cbaz/, [
200,
{ 'Content-Type': 'application/json' },
'{ "query": { "allmessages": [' +
'{ "name": "foo", "content": "Foo bar" },' +
'{ "name": "baz", "content": "Baz Quux" }' +
'] } }'
] );
return new mw.Api().getMessages( [ 'foo', 'baz' ] ).then( function ( messages ) {
assert.deepEqual(
messages,
{
foo: 'Foo bar',
baz: 'Baz Quux'
}
);
} );
} );
}( mediaWiki ) );
|