How do I perform unit tests involving redis, socket.io, and nodejs/express?

Multi tool use
Multi tool use


How do I perform unit tests involving redis, socket.io, and nodejs/express?



I am currently running into problems attempting to create unit tests that involve the interaction of socket.io, redis, and express. I'm looking for strategies on how to best mock these interactions. For example, I am using socket.io-client to mock the connection/behavior of socket.io to my express server but then when I add a test to check if redis is storing the proper information from socket.io I find myself needing to also mock socket.io in the redis unit test which in turn means I need to mock the express server. This leads to the point where it seems like I'm rewriting another server just to unit test the actual server I am trying to test.



Has anyone had to do this before? If so could you point me to resources (google/stack overflow are slim in results)?





unit tests has nothing to do with redis socketio or express etc, its simply testing of any unit / module / function.
– codeofnode
Feb 22 at 20:18





Are you saying you write unit tests to check if redis is working correctly?
– Usman Mutawakil
Feb 22 at 21:12





I guess I meant "integration test". I want to make sure socket.io and redis are interacting correctly based on a request coming in from the express server.
– Steve
Feb 23 at 22:03









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

cGx3v g69
kxXCJ7uv8uDasX4ivbvy86d2gPm4ppJHC8hz 4SmNsTsw4OdPveNtyIm0x8uTh DSRc,7XW4

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications