return sequence( bodies );
}
+ // Utility to make inline use with an assert easier
+ function match( text, pattern ) {
+ var m = text.match( pattern );
+ return m && m[ 1 ] || null;
+ }
+
QUnit.test( 'get()', function ( assert ) {
var api = new mw.Api();
var api = new mw.Api();
this.server.respond( function ( request ) {
- assert.ok( request.url.match( /test=foo%7Cbar%7Cbaz/ ), 'Pipe-separated value was submitted' );
+ assert.equal( match( request.url, /test=([^&]+)/ ), 'foo%7Cbar%7Cbaz', 'Pipe-separated value was submitted' );
request.respond( 200, { 'Content-Type': 'application/json' }, '[]' );
} );
var api = new mw.Api();
this.server.respond( function ( request ) {
- assert.ok( request.url.match( /test=Foo%7CBar/ ), 'Pipe-separated value was submitted' );
+ assert.equal( match( request.url, /test=([^&]+)/ ), 'Foo%7CBar', 'Pipe-separated value was submitted' );
request.respond( 200, { 'Content-Type': 'application/json' }, '[]' );
} );
var api = new mw.Api();
this.server.respond( function ( request ) {
- assert.ok( request.url.match( /test=true%7Cfalse%7C%7C%7C0%7C1%2E2/ ), 'Pipe-separated value was submitted: ' + request.url );
+ assert.equal( match( request.url, /test=([^&]+)/ ), 'true%7Cfalse%7C%7C%7C0%7C1%2E2', 'Pipe-separated value was submitted' );
request.respond( 200, { 'Content-Type': 'application/json' }, '[]' );
} );