Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including karma-chai-immutable with all npm packages installed. Try it out:

var karmaChaiImmutable = require("karma-chai-immutable")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

karma-chai-immutable v1.0.3

Chai and Immutable for Karma

karma-chai-immutable

npm

Makes the chai-immutable adapter for Chai and Immutable available in Karma

Installation

$ npm install karma-chai-immutable --save-dev

Add chai-immutable to the frameworks key in your Karma configuration:

module.exports = function(config) {
  'use strict';
  config.set({
    frameworks: ['mocha', 'chai-immutable'],
    #...
  });
}

Usage

Chai matchers for Immutable are available in tests:

describe('chai-immutable', function () {

  it('can compare objects', function () {
    var a = Immutable.Map({key: 'value'}),
        b = a.merge({key: 'value'}),
        c = a.merge({key: 'other value'});

    a.should.equal(b);
    a.should.not.equal(c);
  });

  it('can check if an Immutable is empty', function () {
    Immutable.List().should.be.empty;
  });
});

See chai-immutable for full documentation.

Thanks

Cheers to chai-immutable and karma!

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free