Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ilib-js/assertextras
Used to extend the assertion types available in nodeunit
https://github.com/ilib-js/assertextras
Last synced: 3 days ago
JSON representation
Used to extend the assertion types available in nodeunit
- Host: GitHub
- URL: https://github.com/ilib-js/assertextras
- Owner: iLib-js
- License: apache-2.0
- Created: 2020-03-24T06:14:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-16T21:01:33.000Z (over 4 years ago)
- Last Synced: 2024-08-08T16:14:28.313Z (3 months ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# assertExtras
Used to extend the assertion types available in nodeunit. To use, simply call:
```javascript
var assert = require("nodeunit/lib/assert");
require("assertextras")(assert);
```At the top of you test suite, and it will monkey-patch the assertions in nodeunit
to add the following types of assertions:- equalIgnoringOrder: compare the contents of arrays without regard to the order
of the array elements
- roughlyEqual: compare two numbers within a threshold amount. Used mostly for
floating point numbers to make sure they are close enough
- contains: make sure all the properties in the expected object also exist
in the actual object. The actual object may have more properties. The ones
in the expected object must exist, and anything else is optional.# Release Notes
v1.1.0
Added updated assert.deepEqual. The old deepEqual would throw
exceptions if one of the two objects passed in were undefined or null.
The part of object equality checking which checks if the objects are
primitives would dereference the objects to call their valueOf()
methods. Of course, you can't dereference undefined or null, so the
exception would get thrown.