Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Automated websocket testing #76

Open
CodingDive opened this issue May 24, 2019 · 1 comment
Open

Automated websocket testing #76

CodingDive opened this issue May 24, 2019 · 1 comment

Comments

@CodingDive
Copy link

CodingDive commented May 24, 2019

Hey there,
we've started adding websockets into our project a few days ago and I really enjoy using it. The API turned out to be great and being able to have middleware is amazing.

Our websocket use case is mostly very unidirectional from Server to Client. Let me give you an example:

  1. User A sends a RESTful request to the Server
  2. Server persists some things into the database and performs other actions.
  3. Server then needs to notify Users B, C that something has changed.

As of now, all my REST api tests are api endpoint tests using trait('Test/ApiClient') and the testing experience + code confidence are incomparable to any other tests I write.

Ideally, I would like to also have a SocketClient trait so that I can register a fake socket Client to a channel, send some HTTP requests and then assert the messages received by my mocked socket Client.

Is there a better way of testing this and how would I go about mocking the Socket Client (which typically runs in the Browser) in node?

@CodingDive
Copy link
Author

CodingDive commented May 24, 2019

The testing section for sockets is also missing from the docs for which I'll happily send a PR.

@thetutlage thetutlage removed the triage label Nov 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants