Package Exports
- assert-helpers
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (assert-helpers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Assert Utilities & Helpers
Common utilities and helpers to make testing assertions easier
Install
NPM
- Use:
require('assert-helpers')
- Install:
npm install --save assert-helpers
Browserify
- Use:
require('assert-helpers')
- Install:
npm install --save assert-helpers
- CDN URL:
//wzrd.in/bundle/assert-helpers@1.0.2
Ender
- Use:
require('assert-helpers')
- Install:
ender add assert-helpers
Usage
assertHelpers = require('assert-helpers')
assertHelpers.wait 1000, ->
# this will execute after 1 second
assertHelpers.throwUnexpected()
# ^ this will throw an error stating that the error was unexpected
assertHelpers.expectEqual('actual results', 'expected results', 'the test name')
# ^ this will check that the actual requests equals the expected results
# it will output the comparison if the comparison fails
assertHelpers.expectDeepEqual('actual results', 'expected results', 'the test name')
# ^ this will check that the actual requests deeply equal the expected results
# it will output the comparison if the comparison fails
assertHelpers.contains('string one', 'string two', 'the test name')
# ^ this will check that string one contains string two
# it will output the comparison if the comparison fails
assertHelpers.expectError(theErrorWeReceived, 'the error we expect it to be', 'the test name')
# ^ this will check that the error we received is the error we expect
# it will output the comparison if the comparison fails
assertHelpers.returnViaCallback('result')
# ^ this will return a function that will return the result
assertHelpers.completeViaCallback('result', 100)
# ^ this will return a function that will receive a completion callback as its first argument, that will call the competion callback with the result after the delay
assertHelpers.returnErrorViaCallback('the error or error message')
# ^ this will return a function that will return the error
assertHelpers.expectViaCallback('expected', 'result', 'arguments')
# ^ this will return a function that will compare it's received arguments with our expected arguments
assertHelpers.expectErrorViaCallback('the error we expect', anOptionalCompletionCallback)
# ^ this will return a function that will compare its received error (its first received argument) with the error we expect it to be
# it will output the comparison if the comparison fails
# it accepts an optional completion callback argument if you'd prefer not to throw the error or are doing an asynchronous test
History
Discover the change history by heading on over to the HISTORY.md
file.
Contribute
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
Backers
Maintainers
These amazing people are maintaining this project:
- Benjamin Lupton b@lupton.cc (https://github.com/balupton)
Sponsors
No sponsors yet! Will you be the first?
Contributors
These amazing people have contributed code to this project:
License
Unless stated otherwise all works are:
- Copyright © 2015+ Bevry Pty Ltd us@bevry.me (http://bevry.me)
and licensed under:
- The incredibly permissive MIT License