Socket
Book a DemoInstallSign in
Socket

jack-chai

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jack-chai

Chai.js assertions for Jack.js test doubles

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
8
33.33%
Maintainers
1
Weekly downloads
 
Created
Source

NPM version Build Status Coverage Status

jack-chai

Synopsis

Chai.js assertions for Jack.js test doubles

Usage

// subject:

var out = {
  test: function() {},
  other: function() {}
};

// test double

jack(out, 'test');

testDouble

Verify that a function is a test double.

expect(out.test).to.be.a.testDouble();
out.test.should.be.a.testDouble();

expect(out.none).to.not.be.a.testDouble();
out.other.should.not.be.a.testDouble();

invoke

Verify that a test double has been invoked.

expect(out.test).to.have.been.invoked();
expect(out.test).invoked();

out.test.should.have.been.invoked();

expect(out.other).to.have.not.been.invoked();
expect(out.other).invoked();

out.other.should.not.have.been.invoked();

max

Verify that a test double has been called max n times.

expect(out.test).to.have.been.called.max(1);
out.test.should.have.been.called.max(1);

min

Verify that a test double has been called min n times.

expect(out.test).to.have.been.called.min(42);
expect(out.test).to.have.been.called.min(42);

out.test.should.have.been.called.min(42);
out.test.should.have.been.called.min(42);

exactly

Verify that a test double has been called exactly n times.

expect(out.test).to.have.been.called.exactly(42);
expect(out.test).to.have.been.called.exactly(42);

out.test.should.have.been.called.exactly(42);
out.test.should.have.been.called.exactly(42);

once

Verify that a test double has been called exactly once.

expect(out.test).to.have.been.called.once();

out.test.should.have.been.called.once();

twice

Verify that a test double has been called exactly twice.

expect(out.test).to.have.been.called.twice();

out.test.should.have.been.called.twice();

on

Verify that a test double has been called on given context.

expect(out.test).to.have.been.called.on(ctx);

out.test.should.have.been.called.on(ctx);

expect(out.test).to.have.not.been.called.on(ctx);

out.test.should.not.have.been.called.on(ctx);

args

Verify that a test double has been called with given arguments.

expect(out.test).to.have.been.called.with.args('foo', 'bar', 42);

out.test.should.have.been.called.with.args('foo', 'bar', 42);

expect(out.test).to.have.not.been.called.with.args('foo', 'bar', 42);

out.test.should.not.have.been.called.with.args('foo', 'bar', 42);

Installation

npm:

npm install jack-chai

component:

component install jackjs/jack-chai

Standalone:

<script src="jack-chai.js></script>

Tests

$ npm test

Coverage:

$ npm run coverage

License

(The MIT License)

Copyright (c) 2013 Veselin Todorov hi@vesln.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

FAQs

Package last updated on 18 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts