a mocked version of a socket.io socket for testing
npm install socket.io-mock





A mock to test the socket.io library implementation.
š Now written in ES6! Bundled with rollup.
> NEW! Added support for disconnect() and close()
bash
npm install socket.io-mock
`Usage
Simply create new socket mock with:
`js
import MockedSocket from 'socket.io-mock';
let socket = new MockedSocket();
`
And use the socket as if it was a normal Socket.io socket.For example:
`js
import SocketMock from 'socket.io-mock';
import { expect } from 'chai';describe('Fast and isolated socket tests', function(){
it('Sockets should be able to talk to each other without a server', function(done) {
let socket = new SocketMock();
socket.on('message', function (message) {
expect(message).to.equal('Hello World!');
});
socket.socketClient.emit('message', 'Hello World!');
});
});
``