Socket
Book a DemoInstallSign in
Socket

socket-io-mock

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socket-io-mock

a mocked version of a socket.io socket for testing

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
2
Created
Source

socket-io-mock

NPM Build Status

A mock to test the socket.io library implementation

Installation

npm install socket-io-mock

Usage

Simply create new socket mock with:

var mockedSocket = new require('socket-io-mock')

And use the socket as if it was a normal Socket.io socket.

For example:

var SocketMock = require('socket-io-mock')
  , should = require('chai').should()

describe('Fast and isolated socket tests', function(){
  it('Sockets should be able to talk to each other without a server', function(done) {
    var socket = new SocketMock()
    
    socket.on('message', function (message) {
      message.should.be.equal('Hello World!')
    })
    socket.emit('message', 'Hello World!')
  })
})

Keywords

socket.io

FAQs

Package last updated on 29 Apr 2015

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