Add --delay option

This commit is contained in:
Typicode
2015-07-21 21:04:50 +02:00
parent 73d55b12aa
commit f277035c52
4 changed files with 30 additions and 2 deletions

View File

@ -91,6 +91,23 @@ describe('cli', function () {
})
describe('db.json -d 1000', function () {
beforeEach(function (done) {
child = cli([dbFile, '-d', 1000])
setTimeout(done, 1000)
})
it('should delay response', function (done) {
var start = new Date()
request.get('/posts').expect(200, function (err) {
var end = new Date()
done(end - start > 1000 ? err : new Error('Request wasn\'t delayed'))
})
})
})
// FIXME test fails on OS X and maybe on Windows
// But manually updating db.json works...
if (os.platform() === 'linux') {