Nose Picking Mechanisms

    socket-io-mock

    1.0.1 • Public • Published

    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!')
      })
    })

    Install

    npm i socket-io-mock

    DownloadsWeekly Downloads

    243

    Version

    1.0.1

    License

    ISC

    Last publish

    Collaborators

    • glemmapaul
    • agconti