jeudi 28 septembre 2017

Testing socket.io with mocha

io.sockets.on('connection', function (socket) {
     // getSessionID is parsing socket.request.headers.cookie for sid
     let sessionID = getSessionID(socket);            
});

i'm using socket.request.headers.cookie to get the session id and then mapping that to socket id....

So my problem is when i'm running mocha tests i won't have any session or cookies set. I really don't want to modify my server to cater to the test i.e. passing through a fake session ID as query.

I was thinking of using selenium but would it be overkill is there a simpler approach.

Aucun commentaire:

Enregistrer un commentaire