completeViaCallback(result, [delay])

./source/index.js

Generate a callback that will receive a completion callback and call it with the specified result after the specified delay

Parameters

  • Any result :

    The result that the callback should pass to the completion callback

  • Number = delay (default 100) :

    The delay in milliseconds that we should wait before calling the completion callback

Returns

Function :

The callback that will provide the specified result

contains(actual, expected, [testName])

./source/index.js

Checks to see if the actual result contains the expected result

Parameters

  • Any actual :

    The result data

  • Any expected :

    The anticipated data

  • string = testName :

    The name of the test

Returns

nothing

Throws

  • Error :

    If the comparison failed, the failure will be thrown

deepEqual(actual, expected, [testName])

./source/index.js

Same as assert.deepEQual in that it performs a deep equals check, but if a failure occurs it will output detailed information

Parameters

  • Any actual :

    The result data

  • Any expected :

    The anticipated data

  • string = testName :

    The name of the test

Returns

nothing

Throws

  • Error :

    If the comparison failed, the failure will be thrown

diffObjects(newData, oldData)

./source/index.js

Return a highlighted comparison between the new data and the old data

Parameters

  • Object newData :

    The new data

  • Object oldData :

    The old data

Returns

string :

The highlighted comparison

diffstrings(newData, oldData)

./source/index.js

Return a highlighted comparison between the new data and the old data

Parameters

  • Object newData :

    The new data

  • Object oldData :

    The old data

Returns

string :

The highlighted comparison

equal(actual, expected, [testName])

./source/index.js

Same as assert.equal in that it performs a strict equals check, but if a failure occurs it will output detailed information

Parameters

  • Any actual :

    The result data

  • Any expected :

    The anticipated data

  • string = testName :

    The name of the test

Returns

nothing

Throws

  • Error :

    If the comparison failed, the failure will be thrown

errorEqual(actualError, expectedError, [testName])

./source/index.js

Checks to see if an error was as expected, if a failure occurs it will output detailed information

Parameters

  • Error actualError :

    The result error

  • ( Error | string | null ) expectedError :

    The anticipated error instance or message, can be null if you expect there to be no error

  • string = testName :

    The name of the test

Returns

nothing

Throws

  • Error :

    If the comparison failed, the failure will be thrown

expectErrorViaCallback(error, [testName], [next])

./source/index.js

Generate a callback that will check the error (if any) it receives for the expected error (if any), if a failure occurs it will output detailed information

Parameters

  • Any error :

    The error instance or message string that we expected, passed as the second argument to errorEqual

  • string = testName :

    The name of the test

  • Function = next :

    An optional completion callback to call with the result of the compairson, if not specified and a failure occurs, the error will be thrown

Returns

Function :

The callback that will check the error (if any) it receives for the expected error (if any)

expectFunctionToThrow(fn, error, [testName])

./source/index.js

Expect the passed function to throw the passed error (if any)

Parameters

  • Function fn :

    The function that we will call and expect to throw the passed error

  • ( Error | string ) error :

    The error instance or message string that we expected, passed as the second argument to errorEqual

  • string = testName :

    The name of the test

Returns

nothing

expectViaCallback(argsExpected)

./source/index.js

Generate a callback that will check the arguments it received with the arguments specified, if a failure occurs it will output detailed information

Parameters

  • ... Any argsExpected :

    The arguments that we expect the callback to receive when it is called

Returns

Function :

The callback that will check the arguments it receives for the expected arguments

inspect(value, [opts])

./source/index.js

Return a stringified version of the value with indentation and colors where applicable

Parameters

  • Any value :

    The value to inspect

  • Object = opts (default {}) :

    The options to pass to util.inspect

Returns

string :

The inspected string of the value

log(args)

./source/index.js

Log the inspected values of each of the arguments to stdout

Parameters

  • ... Any args :

    The arguments to inspect and log

Returns

nothing

returnErrorViaCallback([error])

./source/index.js

Generate a callback that return an error instance with the specified message/error

Parameters

  • ( Error | string ) = error (default 'anerroroccured') :

    The error instance or message string that the callback will return

Returns

Function :

The callback that will return the specified result

returnViaCallback(result)

./source/index.js

Generate a callback that will return the specified result

Parameters

  • Any result :

    The result that the callback should return

Returns

Function :

The callback that will return the specified result

throwErrorViaCallback([error])

./source/index.js

Generate a callback that throw an error instance with the specified message/error

Parameters

  • ( Error | string ) = error (default 'anerroroccured') :

    The error instance or message string that the callback will throw

Returns

Function :

The callback that will throw the specified error