Skip to content

Commit

Permalink
Test for mock GET /batch
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinND committed Jun 25, 2014
1 parent 66a3677 commit 4219b9d
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions test/mock-server.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
'use strict';

var should = require('should');

var Anyfetch = require('../lib/index.js');
var createMockServer = require('../lib/test-server/index.js');
var configuration = require('../config/configuration.js');

describe('<Mock server>', function() {
var anyfetch = new Anyfetch(configuration.test.login, configuration.test.password);

before(function(done) {
var server = createMockServer();
var port = configuration.test.port;
server.listen(port, function() {
console.log('Mock server running on port ' + port);
var apiHost = 'http://localhost:' + port;
console.log('Mock server running on ' + apiHost);
anyfetch.setApiHost(apiHost);

done();
});
});

it('should handle batch calls smartly', function(done) {
// TODO
done();
it('should respond with all the mocks we asked for', function(done) {
var pages = ['/document_types', '/providers', '/users', '/company'];
anyfetch.getBatch({ pages: pages }, function(err, res) {
should(err).not.be.ok;
should(res.body).be.ok;
res.body.should.have.keys(pages);
done();
});
});

});

0 comments on commit 4219b9d

Please sign in to comment.