Socket
Socket
Sign inDemoInstall

angular-ws-mock

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-ws-mock

Mock for AngularJS WebSocket service.


Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

angular-ws-mock

Build Status Dependency Status devDependency Status

Mock for AngularJS WebSocket service.

Install

bower install angular-ws-mock

Usage

describe('My service', function () {
  var ws, myService;

  beforeEach(module('app', 'wsMock'));

  beforeEach(inject(function ($injector) {
    ws = $injector.get('ws');
    myService = $injector.get('myService');
  }));

  it('should connect to the WebSocket', function () {
    ws.emit('open');

    expect(ws.getReadyState()).to.equal(1);
  });

ws.emit(event, data)

Emit a new event.

ws.emit('message', {data: 'my message'});

ws.messages

Read the messages sent.

ws.send('hello')
console.log(ws.messages); // ['hello']

ws.reset()

Empty messages.

ws.send('hello')
console.log(ws.messages); // ['hello']
ws.reset();
console.log(ws.messages); // []

License

MIT

FAQs

Package last updated on 11 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc