Skip to content

Commit

Permalink
test(socket): add coverage for timeout without a callback
Browse files Browse the repository at this point in the history
For #1404 

* test(socket): add coverage for timeout without a callback
  • Loading branch information
mastermatt committed Jul 15, 2019
1 parent f8d6cbb commit a201ac0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_socketdelay.js
Expand Up @@ -112,3 +112,18 @@ test('Socket#setTimeout adds callback as a one-time listener for parity with a r
socket.setTimeout(50, onTimeout)
})
})

test('Socket#setTimeout can be called without a callback', t => {
nock('http://example.test')
.get('/')
.socketDelay(100)
.reply()

http.get('http://example.test').on('socket', socket => {
socket.setTimeout(50)

socket.on('timeout', () => {
t.end()
})
})
})

0 comments on commit a201ac0

Please sign in to comment.