# socket-io-mock

> a mocked version of a socket.io socket for testing

Latest version **1.0.1** (published 2015-04-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install socket-io-mock
pnpm add socket-io-mock
yarn add socket-io-mock
bun add socket-io-mock
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-04-29 |
| First published | 2015-04-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Paul Oostenrijk |
| Maintainers | glemmapaul, agconti |
| Keywords | socket.io, test, mock, socket |

## Links

- npm: https://www.npmjs.com/package/socket-io-mock
- Repository: https://github.com/glemmaPaul/socket-io-mock
- Homepage: https://github.com/glemmaPaul/socket-io-mock#readme
- Issues: https://github.com/glemmaPaul/socket-io-mock/issues
- npm.io page: https://npm.io/package/socket-io-mock

## Dependencies (3)

- [chai](https://npm.io/package/chai.md) ^2.2.0
- [debug](https://npm.io/package/debug.md) ^2.1.3
- [mocha](https://npm.io/package/mocha.md) ^2.2.4

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-04-29
- 1.0.0 — 2015-04-29

## README

# socket-io-mock
[![NPM](https://nodei.co/npm/socket-io-mock.png?compact=true)](https://npmjs.org/package/socket-io-mock?compact=true)
[![Build Status](https://travis-ci.org/glemmaPaul/socket-io-mock.svg?branch=master)](https://travis-ci.org/glemmaPaul/socket-io-mock)


A mock to test the socket.io library implementation

# Installation 
```bash
npm install socket-io-mock
```

# Usage
Simply create new socket mock with:
```js
var mockedSocket = new require('socket-io-mock')
```
And use the socket as if it was a normal Socket.io socket. 

For example:

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

---
_Source: https://npm.io/package/socket-io-mock · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
