pusher-js-mock
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "pusher-js-mock", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Mock Pusher.js in your JavaScript tests", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"clean": "rimraf lib", | ||
"precommit": "yarn doc && git add -A" | ||
"precommit": "yarn lint && yarn doc && git add -A" | ||
}, | ||
@@ -38,19 +38,16 @@ "repository": { | ||
"babel-register": "^6.26.0", | ||
"chai": "^4.1.2", | ||
"dirty-chai": "^2.0.1", | ||
"eslint": "^4.7.2", | ||
"eslint-config-airbnb": "^15.1.0", | ||
"eslint-config-airbnb": "^16.1.0", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-jsx-a11y": "^5.1.1", | ||
"eslint-plugin-jest": "^21.12.2", | ||
"eslint-plugin-jsx-a11y": "^6.0.3", | ||
"eslint-plugin-react": "^7.4.0", | ||
"husky": "^0.14.3", | ||
"istanbul": "^1.0.0-alpha", | ||
"jest": "^22.4.2", | ||
"jsdoc": "^3.5.5", | ||
"lint-staged": "^7.0.0", | ||
"mocha": "^3.5.3", | ||
"mocha": "^5.0.1", | ||
"prettier": "^1.10.2", | ||
"rimraf": "^2.6.2", | ||
"sinon": "^4.0.0", | ||
"sinon-chai": "^2.14.0" | ||
"pusher-js": "^4.2.2", | ||
"rimraf": "^2.6.2" | ||
}, | ||
@@ -57,0 +54,0 @@ "engines": { |
[![Build Status](https://semaphoreci.com/api/v1/nikolalsvk/pusher-js-mock/branches/master/shields_badge.svg)](https://semaphoreci.com/nikolalsvk/pusher-js-mock) | ||
[![Code Climate](https://codeclimate.com/github/nikolalsvk/pusher-js-mock/badges/gpa.svg)](https://codeclimate.com/github/nikolalsvk/pusher-js-mock) | ||
[![Test Coverage](https://codeclimate.com/github/nikolalsvk/pusher-js-mock/badges/coverage.svg)](https://codeclimate.com/github/nikolalsvk/pusher-js-mock/coverage) | ||
[![Open Source Helpers](https://www.codetriage.com/nikolalsvk/pusher-js-mock/badges/users.svg)](https://www.codetriage.com/nikolalsvk/pusher-js-mock) | ||
@@ -11,2 +12,14 @@ ![pusher-js-mock logo](logo.jpg) | ||
### Installing | ||
Using yarn: | ||
``` | ||
yarn add --dev pusher-js-mock | ||
``` | ||
Or using npm: | ||
``` | ||
npm install -D pusher-js-mock | ||
``` | ||
### Example usage | ||
@@ -13,0 +26,0 @@ |
@@ -1,11 +0,3 @@ | ||
import chai, { expect } from 'chai'; | ||
import dirtyChai from 'dirty-chai'; | ||
import sinon from 'sinon'; | ||
import sinonChai from 'sinon-chai'; | ||
import PusherChannelMock from '../pusher-channel-mock'; | ||
chai.use(dirtyChai); | ||
chai.use(sinonChai); | ||
describe('PusherChannelMock', () => { | ||
@@ -19,3 +11,3 @@ let channelMock; | ||
it('initializes callbacks object', () => { | ||
expect(channelMock.callbacks).to.be.empty(); | ||
expect(channelMock.callbacks).toEqual({}); | ||
}); | ||
@@ -28,4 +20,4 @@ | ||
expect(channelMock.callbacks).to.have.all.keys('my-channel'); | ||
expect(channelMock.callbacks['my-channel']).to.equal(callback); | ||
expect(channelMock.callbacks).toMatchObject({ 'my-channel': callback }); | ||
expect(channelMock.callbacks['my-channel']).toEqual(callback); | ||
}); | ||
@@ -39,3 +31,3 @@ }); | ||
beforeEach(() => { | ||
callback = sinon.spy(); | ||
callback = jest.fn(); | ||
channelMock.bind('my-channel', callback); | ||
@@ -47,3 +39,3 @@ }); | ||
expect(callback).to.have.been.called(); | ||
expect(callback).toHaveBeenCalledTimes(1); | ||
}); | ||
@@ -55,3 +47,3 @@ | ||
expect(callback).to.have.been.calledWith('you used to call me on my cellphone'); | ||
expect(callback).toBeCalledWith('you used to call me on my cellphone'); | ||
}); | ||
@@ -62,6 +54,6 @@ }); | ||
it('returns null', () => { | ||
const callback = sinon.spy(); | ||
const callback = jest.fn(); | ||
channelMock.emit('my-channel'); | ||
expect(callback).to.not.have.been.called(); | ||
expect(callback).not.toHaveBeenCalled(); | ||
}); | ||
@@ -68,0 +60,0 @@ }); |
@@ -1,3 +0,1 @@ | ||
import { expect } from 'chai'; | ||
import PusherFactoryMock from '../pusher-factory-mock'; | ||
@@ -14,3 +12,3 @@ | ||
it('initializes pusherKey', () => { | ||
expect(pusherFactoryMock.pusherKey).to.equal('19ir1pkcj13'); | ||
expect(pusherFactoryMock.pusherKey).toEqual('19ir1pkcj13'); | ||
}); | ||
@@ -20,5 +18,5 @@ | ||
it('return an object', () => { | ||
expect(pusherFactoryMock.pusherClient()).to.be.an('object'); | ||
expect(pusherFactoryMock.pusherClient()).toBeDefined(); | ||
}); | ||
}); | ||
}); |
@@ -1,8 +0,3 @@ | ||
import chai, { expect } from 'chai'; | ||
import dirtyChai from 'dirty-chai'; | ||
import PusherMock from '../pusher-js-mock'; | ||
chai.use(dirtyChai); | ||
describe('PusherMock', () => { | ||
@@ -16,3 +11,3 @@ let pusherMock; | ||
it('initializes channels object', () => { | ||
expect(pusherMock.channels).to.be.empty(); | ||
expect(pusherMock.channels).toEqual({}); | ||
}); | ||
@@ -22,3 +17,3 @@ | ||
it('returns instance of PusherChannelMock', () => { | ||
expect(pusherMock.channel('my-channel')).to.be.an('object'); | ||
expect(pusherMock.channel('my-channel')).toBeDefined(); | ||
}); | ||
@@ -28,3 +23,3 @@ | ||
pusherMock.channel('my-channel'); | ||
expect(pusherMock.channels).to.have.all.keys('my-channel'); | ||
expect(pusherMock.channels).toMatchObject({ 'my-channel': {} }); | ||
}); | ||
@@ -38,7 +33,7 @@ | ||
it('returns instance of PusherChannelMock', () => { | ||
expect(pusherMock.channel('my-channel')).to.be.an('object'); | ||
expect(pusherMock.channel('my-channel')).toBeDefined(); | ||
}); | ||
it('adds new channel to channels object', () => { | ||
expect(pusherMock.channels).to.have.all.keys('my-channel'); | ||
expect(pusherMock.channels).toMatchObject({ 'my-channel': {} }); | ||
}); | ||
@@ -50,3 +45,3 @@ }); | ||
it('returns instance of PusherChannelMock', () => { | ||
expect(pusherMock.subscribe('my-channel')).to.be.an('object'); | ||
expect(pusherMock.channel('my-channel')).toBeDefined(); | ||
}); | ||
@@ -56,5 +51,5 @@ | ||
pusherMock.subscribe('my-channel'); | ||
expect(pusherMock.channels).to.have.all.keys('my-channel'); | ||
expect(pusherMock.channels).toMatchObject({ 'my-channel': {} }); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21
82
2784750
817