angular / ngSocket

WebSocket support for angular
Apache License 2.0
204 stars 25 forks source link

Provide a WebSocket mocking service. #3

Open baalexander opened 10 years ago

baalexander commented 10 years ago

It would be awesome if there was something like $httpBackend for mocking WebSocket calls. It looks like you've already started the process with WSMock in your spec file.

Functionality that would be nice:

jeffbcross commented 10 years ago

Good call

jeffbcross commented 10 years ago

I created a base mock module and backend service in this commit, LMK what you think: https://github.com/jeffbcross/ngSocket/commit/beac73ee57c876cc7a34b7f4d991389bfc0bb91a

Your first and third bullets are satisfied with the current implementation, but not the 2nd bullet yet.

baalexander commented 10 years ago

This looks good, thanks!

For spying on send calls, is the idea I would inspect pendingSends after calling MockWebSocket's .send()?

begriffs commented 10 years ago

Looking forward to being able to fake responses from ngSocketBackend. Any plans to add this in the near future?