Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

Commit daf4f24

Browse files
Confirm onBootstrap returned too.
1 parent 20ca185 commit daf4f24

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/unit/app/torTest.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,24 @@ describe('tor unit tests', function () {
260260
}, 2000)
261261
const done = () => killTor(torDaemon, torProcess, callback)
262262
let countdown = 2
263+
let bootstrapped1 = false
263264
const bootstrapped = (err, progress) => {
264265
assert.ifError(err)
265266
clearTimeout(bootstrapTimeout)
266267
console.log(`tor: bootstrapped ${progress}%`)
267-
if (--countdown === 0) {
268-
return done()
268+
if (!bootstrapped1) {
269+
// Got at least one bootstrap progress notification.
270+
bootstrapped1 = true
271+
if (--countdown === 0) {
272+
// And onBootstrap returned.
273+
return done()
274+
}
269275
}
270276
}
271277
torDaemon.onBootstrap(bootstrapped, (err) => {
272278
assert.ifError(err)
273279
if (--countdown === 0) {
280+
// Got at least one bootstrap progress notification too.
274281
return done()
275282
}
276283
})

0 commit comments

Comments
 (0)