I have a TDD'ing script that connects to Socket from the net module.
For testing I use mocha and for sinonjs ridicule
Now I really have the problem of bullying / falsifying the emission of socket data.
For example: I want to check this code:
socket.on('data', function (data) { console.log(data); }
How can I fake "data"?
source share