Module assert

Assertion library covering CommonJS Unit Testing.

Functions


ArgumentsError ({String} )

Creates a new ArgumentsError instance

Parameters

{String} message The exception message

Returns

A newly created ArgumentsError instance

AssertionError ({Object} )

Constructs a new AssertionError instance

Parameters

{Object} options An object containing error details

deepEqual ({Object} , {Object} )

Checks if the values passed as arguments are deep equal

Parameters

{Object} actual The actual value
{Object} expected The expected value

Throws

ArgumentsError, AssertionError

equal ({Object} , {Object} )

Checks if the values passed as arguments are equal.

Parameters

{Object} actual The actual value
{Object} expected The expected value

Throws

ArgumentsError, AssertionError

notDeepEqual ({Object} , {Object} )

Checks if the values passed as arguments are not deep equal

Parameters

{Object} actual The actual value
{Object} expected The expected value

Throws

ArgumentsError, AssertionError

notEqual ({Object} , {Object} )

Checks if the values passed as arguments are not equal.

Parameters

{Object} actual The actual value
{Object} expected The expected value

Throws

ArgumentsError, AssertionError

notStrictEqual ({Object} , {Object} )

Checks if the values passed as arguments are not strictly equal

Parameters

{Object} actual The actual value
{Object} expected The expected value

Throws

ArgumentsError, AssertionError

ok ({Object} )

Checks if the value passed as argument is truthy.

Parameters

{Object} value The value to check for truthiness

Throws

ArgumentsError, AssertionError

strictEqual ({Object} , {Object} )

Checks if the values passed as arguments are strictly equal

Parameters

{Object} actual The actual value
{Object} expected The expected value

Throws

ArgumentsError, AssertionError

throws ({Object} , {Object} )

Checks if the function passed as argument throws a defined exception.

Parameters

{Object} func The function to call
{Object} expectedError Optional object expected to be thrown when executing the function

Throws

ArgumentsError, AssertionError