This package has been deprecated

Author message:

THIS PROJECT IS NO LONGER MAINTAINED by clebert

expressive-assertion

1.5.1 • Public • Published

expressive-assertion

Expressive assertions for JavaScript.

license npm downloads

build code climate coverage code climate dependencies devDependencies

Sauce Test Status

Getting Started

Installation

npm install expressive-assertion --save

Integration

var assert = require('expressive-assertion');

API

assert(predicate, [...])

assert(function () {
    return true;
}); // OK
 
assert(function () {
    return false;
}); // AssertionError: assert(function () { return false; })
 
assert(function () {
    return true;
}, function () {
    return true;
}); // OK
 
assert(function () {
    return true;
}, function () {
    return false;
}); // AssertionError: assert(function () { return false; })

assert.throws(block, [predicate], [...])

assert.throws(function () {
    throw 'foo';
}); // OK
 
assert.throws(function () {
    return 'foo';
}); // AssertionError: Missing expected exception.
 
assert.throws(function () {
    throw 'foo';
}, function (exception) {
    return exception === 'foo';
}); // OK
 
assert.throws(function () {
    throw 'foo';
}, function (exception) {
    return exception !== 'foo';
}); // AssertionError: assert(function (exception) { return exception !== 'foo'; })
 
assert.throws(function () {
    return 'foo';
}, function (exception) {
    return exception === 'foo';
}); // AssertionError: Missing expected exception.
 
assert.throws(function () {
    throw 'foo';
}, function (exception) {
    return exception === 'foo';
}, function (exception) {
    return exception !== 'bar';
}); // OK
 
assert.throws(function () {
    throw 'foo';
}, function (exception) {
    return exception === 'foo';
}, function (exception) {
    return exception !== 'foo';
}); // AssertionError: assert(function (exception) { return exception !== 'foo'; })
 
assert.throws(function () {
    return 'foo';
}, function (exception) {
    return exception === 'foo';
}, function (exception) {
    return exception !== 'bar';
}); // AssertionError: Missing expected exception.

Running Tests

To run the test suite first install the development dependencies:

npm install

then run the tests:

npm test

Readme

Keywords

Package Sidebar

Install

npm i expressive-assertion

Weekly Downloads

5

Version

1.5.1

License

none

Last publish

Collaborators

  • clebert