1.3.2 ā€¢ Published 3 years ago

socket.io-mock v1.3.2

Weekly downloads
5,421
License
MIT
Repository
github
Last release
3 years ago

socket.io-mock

npm version npm license XO code style

Build Status Code Climate Test Coverage Issue Count npm npm

A mock to test the socket.io library implementation.

šŸš€ Now written in ES6! Bundled with rollup.

NEW! Added support for disconnect() and close()

Installation

npm install socket.io-mock

Usage

Simply create new socket mock with:

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:

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

3 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.4

4 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago