Add unit tests for mw.format()
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 24 Nov 2015 20:06:52 +0000 (20:06 +0000)
committerOri.livneh <ori@wikimedia.org>
Tue, 24 Nov 2015 20:32:02 +0000 (20:32 +0000)
Follows-up ec285f44200f6574.

Change-Id: Ic3ff05c0f48bd6101361312af70ca2b2c52ef79a

tests/qunit/suites/resources/mediawiki/mediawiki.test.js

index d205ba7..f7c8d17 100644 (file)
                this.restoreWarnings();
        } );
 
+       QUnit.test( 'mw.format', 2, function ( assert ) {
+               assert.equal(
+                       mw.format( 'Format $1 $2', 'foo', 'bar' ),
+                       'Format foo bar',
+                       'Simple parameters'
+               );
+               assert.equal(
+                       mw.format( 'Format $1 $2' ),
+                       'Format $1 $2',
+                       'Missing parameters'
+               );
+       } );
+
        QUnit.test( 'mw.Map', 35, function ( assert ) {
                var arry, conf, funky, globalConf, nummy, someValues;