Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

socket.io-mock

Package Overview
Dependencies
Maintainers
1
Versions
13
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

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
decreased by-12.48%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 10 May 2021

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