Hi folks.

I have a socket.io server that verify the extra headers for authorization 
tokens, in that case, I use the jwt to validate de token and validate the 
connection.

Therefore, um a unit test case, I need to mock the decode function to test 
the connection. Where is a simple unit test case that check the connection 
event, I don't necessary need to send the token, as I can mock the decode 
behaviour to return *true* to my handshake validator and connects 
successfully.

My problem where: the authStub, that is a jwt.decode stub, doesn't get 
called, so my test fails.

Here is a gist <https://pastebin.com/qXwAvW0C> with connection 
test(index.test.js) and my authenticate method, the where called by a 
middleware(socket.use) with the headers and socket as parameters,

What could be wrong? In the first assertion, the authStub should get 
called, but there's not.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/d5c922c4-fd8b-4eae-9748-002997e75029%40googlegroups.com.

Reply via email to