Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/z4o4z/chai-sequencer

event sequncer plugin for chai.js
https://github.com/z4o4z/chai-sequencer

Last synced: 29 days ago
JSON representation

event sequncer plugin for chai.js

Awesome Lists containing this project

README

        

# chai-sequencer

> Check your event sequence with Mocha, Chai and Sequencer

## Install

`npm i chai-sequencer --save`

##### Quick Example

let chai = require('chai');
let expect = chai.expect;
let sequencer = require("../index");
let EventEmitter = require('events');

chai.use(sequencer);

let ee = new EventEmitter();

describe('sequencer', function() {

beforeEach(function() {
ee.on('test1', () => console.log('test1 called'))
});

afterEach(function() {
ee.removeAllListeners();
});

it('quick test', function () {
ee.emit('test1');
ee.emit('test2');
ee.emit('test3');
ee.emit('test4');
ee.emit('test4');
ee.emit('test6');
ee.emit('test8');
ee.emit('test9');

expect(ee).to
.emit('test1')
.next('test2')
.next.skip(2)
.is('test4')
.is.calls(2)
.next.oneOf('test5', 'test6', 'test7')
.next('test8')
.last('test9');
});
});