expected-kefir

This is a universal library for testing observables from KefirJS.

Usage no npm install needed!

<script type="module">
  import expectedKefir from 'https://cdn.skypack.dev/expected-kefir';
</script>

README

Expected Kefir

This is a universal library for testing observables from KefirJS.

It assumes that observable ends at expected array end. If a test fails it will throw an Error.

Install

npm i expected-kefir

Example usage with Mocha

var { expect } = require('expected-kefir');
var kefir = require('kefir');

describe('samle test', function () {

    it(`works`, function () {
        expect(kefir
            .constant([1, 2, 3, 4])
            .flatten()
            .map(n => n * 2))
            .toEmit([2, 4, 6, 8])
    })

})

Output


  samle test
    ✔ works


  1 passing (14ms)

API

expect(kefirJsObservable)
    .toEmit(expectedArrayEmits)

Contributors

Warmly welcome!