-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); | ||
|
||
}); |