Given something like:
let srv = Mitm()
let client = irc.Client.create({
host: 'irc.example.com',
port: 6667,
nick: 'topaxi',
user: 'topaxi'
})
let subscription = client.subscribe()
srv.on('connection', () => {
subscription.unsubscribe()
srv.disable()
done()
})
The subscription will be undefined in the connection event, this makes it kinda hard to write tests without introducing manual process.nextTick(...) calls.
I've tried putting the subscribe() call below the 'connection' event, but this won't work as connection will be triggered inside my subscribe call (because Mitm seems to make this sync).
Given something like:
The subscription will be
undefinedin theconnectionevent, this makes it kinda hard to write tests without introducing manualprocess.nextTick(...)calls.I've tried putting the
subscribe()call below the 'connection' event, but this won't work asconnectionwill be triggered inside mysubscribecall (because Mitm seems to make this sync).