Skip to content

Commit

Permalink
Added a test to make sure old syntax worked, also embedded in desc block
Browse files Browse the repository at this point in the history
  • Loading branch information
basicallydan committed Nov 30, 2015
1 parent 7289a54 commit 7ee4ba7
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions tests/fluent.test.js
Expand Up @@ -188,16 +188,30 @@ describe('Interfake Fluent JavaScript API', function () {
});
});

it('should use an array to find array query string params, regardless of order', function (done) {
interfake.get('/fluent').query({ pages: [ '1', '2' ]}).status(200);
interfake.listen(3000);
describe('when a query parameter has an array value', function () {
it('should use an array to find array query string params regardless of order', function (done) {
interfake.get('/fluent').query({ pages: [ '1', '2' ]}).status(200);
interfake.listen(3000);

Q.all([get({url:'http://localhost:3000/fluent?pages=1&pages=2',json:true}), get({url:'http://localhost:3000/fluent?pages=2&pages=1',json:true})])
.then(function (results) {
assert.equal(results[0][0].statusCode, 200);
assert.equal(results[1][0].statusCode, 200);
done();
});
Q.all([get({url:'http://localhost:3000/fluent?pages=1&pages=2',json:true}), get({url:'http://localhost:3000/fluent?pages=2&pages=1',json:true})])
.then(function (results) {
assert.equal(results[0][0].statusCode, 200);
assert.equal(results[1][0].statusCode, 200);
done();
});
});

it('should use an array to find array query string params using the older square-bracket syntax', function (done) {
interfake.get('/fluent').query({ pages: [ '1', '2' ]}).status(200);
interfake.listen(3000);

Q.all([get({url:'http://localhost:3000/fluent?pages[]=1&pages[]=2',json:true}), get({url:'http://localhost:3000/fluent?pages[]=2&pages[]=1',json:true})])
.then(function (results) {
assert.equal(results[0][0].statusCode, 200);
assert.equal(results[1][0].statusCode, 200);
done();
});
});
});

describe('#status()', function () {
Expand Down

0 comments on commit 7ee4ba7

Please sign in to comment.