I would like to be able to do something similar. Like
sServer = newSocketServerMock("/myScope");
sServer.start(); // maybe this will trigger the connect event in the client// test something and assert an action triggered by an eventsServer.emit(eventName, eventPayload);
// boom, the action got triggered.sServer.stop(); // this could trigger the disconnect
Looking at the code my first impression on how to do this is to extend the Manager class and provide the functionality to always be connected and a method to emit an event, then in the Socket or Options class set this Manager to be used. Do you think this is a good approach? if so I might start working on something.
Some of the private definitions in the classes did not allowed me to successfully create a stub of the Manager without rewriting a lot of code, but in the meantime I just used the Emitter class as my socket object.