assert-deep-strict-equal
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,4 +0,4 @@ | ||
//! assert-deep-strict-equal v0.0.1 ~ github.com/center-key/assert-deep-strict-equal ~ MIT License | ||
//! assert-deep-strict-equal v0.0.2 ~ github.com/center-key/assert-deep-strict-equal ~ MIT License | ||
declare const assertDeepStrictEqual: (actual: unknown, expected: unknown, done?: ((e?: unknown) => void) | undefined) => void; | ||
export { assertDeepStrictEqual }; |
@@ -1,2 +0,2 @@ | ||
//! assert-deep-strict-equal v0.0.1 ~ github.com/center-key/assert-deep-strict-equal ~ MIT License | ||
//! assert-deep-strict-equal v0.0.2 ~ github.com/center-key/assert-deep-strict-equal ~ MIT License | ||
@@ -3,0 +3,0 @@ import { deepStrictEqual } from 'assert'; |
{ | ||
"name": "assert-deep-strict-equal", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Async assert fails in Mocha you can see and don't timeout (written in TypeScript)", | ||
@@ -57,6 +57,7 @@ "license": "MIT", | ||
"scripts": { | ||
"lint": " jshint *.js spec && eslint --max-warnings 0 . --ext .ts", | ||
"tsc": " tsc --version && tsc --project . && tsc --project . --module UMD --outDir build/umd", | ||
"pretest": "npm run lint && rimraf build dist **/.DS_Store && npm run tsc && gulp make-dist", | ||
"test": " mocha spec/*.spec.js" | ||
"examples": "npm test && mocha examples.spec.js", | ||
"lint": " jshint *.js spec && eslint --max-warnings 0 . --ext .ts", | ||
"tsc": " tsc --version && tsc --project . && tsc --project . --module UMD --outDir build/umd", | ||
"pretest": " npm run lint && rimraf build dist **/.DS_Store && npm run tsc && gulp make-dist", | ||
"test": " mocha spec/*.spec.js --timeout 5000" | ||
}, | ||
@@ -69,2 +70,3 @@ "dependencies": {}, | ||
"eslint": "~7.29", | ||
"fetch-json": "~2.4", | ||
"gulp": "~4.0", | ||
@@ -78,2 +80,3 @@ "gulp-header": "~2.0", | ||
"mocha": "~9.0", | ||
"node-fetch": "~2.6", | ||
"rimraf": "~3.0", | ||
@@ -80,0 +83,0 @@ "typescript": "~4.3" |
@@ -27,1 +27,45 @@ # assert-deep-strict-equal | ||
``` | ||
The third parameter for the `done` callback is optional: | ||
```javascript | ||
assertDeepStrictEqual(actual, expected); //synchronous test case | ||
``` | ||
## 3) Example | ||
```javascript | ||
describe('Star Wars API result for spaceship #3', () => { | ||
it('is a Star Destroyer', (done) => { | ||
const url = 'https://swapi.py4e.com/api/starships/3/'; | ||
const handleData = (data) => { | ||
const actual = { | ||
name: data.name, | ||
model: data.model, | ||
manufacturer: data.manufacturer, | ||
}; | ||
const expected = { | ||
name: 'Star Destroyer', | ||
model: 'Imperial I-class Star Destroyer', | ||
manufacturer: 'Kuat Drive Yards', | ||
}; | ||
assertDeepStrictEqual(actual, expected, done); | ||
}; | ||
fetchJson.get(url, { format: 'json' }).then(handleData); | ||
}); | ||
}); | ||
``` | ||
Commands to run the above **Star Destroyer** example and others in [examples.spec.js](examples.spec.js): | ||
```shell | ||
$ cd assert-deep-strict-equal | ||
$ npm install | ||
$ npm run examples | ||
``` | ||
<img src=https://raw.githubusercontent.com/center-key/assert-deep-strict-equal/main/examples.png | ||
width=800 alt=screenshot> | ||
Note that the assertion failure does _not_ cause a timeout and the test case error is easy to see and interpret. | ||
The value of the `name` field is `"BOGUS!"` (red), but it was expected to be `"payapa-berry"` (green). | ||
<br> | ||
--- | ||
[MIT License](LICENSE.txt) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8092
71
16