Skip to content

Commit

Permalink
Test if the delay actually happens
Browse files Browse the repository at this point in the history
Lower it slightly.
  • Loading branch information
mmalecki committed Aug 6, 2018
1 parent ec85815 commit 152534a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/simple-test.js
Expand Up @@ -172,16 +172,20 @@ describe('Hock HTTP Tests', function() {
});

it('should work with a delay configured', function(done) {
const DELAY = 500

hockInstance
.get('/url')
.delay(1000)
.delay(DELAY)
.reply(200, { 'hock': 'ok' });

const start = Date.now()
request('http://localhost:' + PORT + '/url', function(err, res, body) {
should.not.exist(err);
should.exist(res);
res.statusCode.should.equal(200);
JSON.parse(body).should.eql({ 'hock': 'ok' });
(Date.now() - start).should.be.aboveOrEqual(DELAY);
done();

});
Expand Down

0 comments on commit 152534a

Please sign in to comment.