Chai's helpers for the tests of the nodules' modules.
JavaScript
Latest commit 2d8f86f Dec 7, 2015 @narqo narqo Merge pull request #4 from isqua/codestyle
Migrate to nodules-style
Permalink
Failed to load latest commit information.
lib Fix codestyle Dec 6, 2015
test Fix codestyle Dec 6, 2015
.eslintrc Migrate to nodules-style Dec 6, 2015
.gitignore initial commit Jan 23, 2014
.jscsrc Migrate to nodules-style Dec 6, 2015
.travis.yml Add recent nodejs versions Dec 6, 2015
CHANGELOG initial commit Jan 23, 2014
LICENSE initial commit Jan 23, 2014
README.md Add badges Jan 17, 2015
package.json Migrate to nodules-style Dec 6, 2015

README.md

Nodules-specific assertions for Chai

NPM version Build status devDependency status

Installation and usage

$ npm install chai-nodules-helpers
var assert = require('chai').use(require('chai-nodules-helpers')).assert;

assert.throwTerror(...);
assert.mixedProperly(...);

Note

All assertions available for assert style only.

Objex

assert.isMixed()

assert.isMixed(Target, Mixin, mixinName, staticExceptions, prototypeExceptions, mixingArgs)

  • {Objex} Target – constructor;
  • {Function|Object} Mixin – mixin;
  • {String} mixinName – used in assertions messages;
  • {String[]} staticExceptions – array of statics propertyies names excluded from assertions;
  • {String[]} prototypeExceptions – array of prototypes propertyies names excluded from assertions;
  • {Array} [mixingArgs] – additional arguments to pass to mixin() after Mixin itself.

assert.canBeMixed()

assert.canBeMixed(Target, Mixin, mixinName, staticExceptions, prototypeExceptions, mixingArgs)

  • {Objex} Target – constructor, inheritor of the Objex, mixin method applies to;
  • {Function|Object} Mixin – mixin;
  • {String} mixinName – used in assertions messages;
  • {String[]} staticExceptions – array of statics propertyies names excluded from assertions;
  • {String[]} prototypeExceptions – array of prototypes propertyies names excluded from assertions;
  • {Array} [mixingArgs] – additional arguments to pass to mixin() after Mixin itself.

Terror

assert.throwTerror()

assert.throwTerror(fn, ErrorClass, spec)

  • {Function} fn – a function which expected to throw;
  • {Fucntion|Error|Terror} [ErrorClass] – must be a Terror inheritor, if spec is specified, or any Error inheritor in other case;
  • {RegExp|String|Number} [spec] – error specifier; can be a string (Terror code name), number (Terror code) or RegExp (used for message test).

If second argument is not a constructor (function), then helper recognize it as an specifier arg spec.