Skip to content

Commit

Permalink
Add tests for responseStartTime
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Aug 28, 2016
1 parent 33aa744 commit ba2d946
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test-timing.js
Expand Up @@ -27,21 +27,26 @@ tape('setup', function(t) {

tape('non-redirected request is timed', function(t) {
var options = {time: true}
request('http://localhost:' + plain_server.port + '/', options, function(err, res, body) {
var r = request('http://localhost:' + plain_server.port + '/', options, function(err, res, body) {
t.equal(err, null)
t.equal(typeof res.elapsedTime, 'number')
t.equal(typeof res.responseStartTime, 'number')
t.equal((res.elapsedTime > 0), true)
t.equal((res.responseStartTime > r.startTime), true)
t.end()
})
})

tape('redirected request is timed with rollup', function(t) {
var options = {time: true}
request('http://localhost:' + plain_server.port + '/redir', options, function(err, res, body) {
var r = request('http://localhost:' + plain_server.port + '/redir', options, function(err, res, body) {
t.equal(err, null)
t.equal(typeof res.elapsedTime, 'number')
t.equal(typeof res.responseStartTime, 'number')
t.equal((res.elapsedTime > 0), true)
t.equal((res.responseStartTime > 0), true)
t.equal((res.elapsedTime > redirect_mock_time), true)
t.equal((res.responseStartTime > r.startTime), true)
t.end()
})
})
Expand Down

0 comments on commit ba2d946

Please sign in to comment.