https://github.com/shigma/chai-shape
extend chai with shape assertions
https://github.com/shigma/chai-shape
Last synced: 3 months ago
JSON representation
extend chai with shape assertions
- Host: GitHub
- URL: https://github.com/shigma/chai-shape
- Owner: shigma
- License: mit
- Created: 2021-11-30T15:21:35.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-12T17:56:35.000Z (almost 3 years ago)
- Last Synced: 2024-10-05T11:42:08.157Z (8 months ago)
- Language: TypeScript
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# chai-shape
[](https://codecov.io/gh/shigma/chai-shape)
[](https://www.npmjs.com/package/chai-shape)Extend chai with shape assertions.
```js
import { expect, use } from 'chai'
import shape from 'chai-shape'use(shape)
// use with array
expect([1, 2, 3]).to.have.shape([1, 2])// use with object
expect({ a: 1, b: 2 }).to.have.shape({ a: 1 })// use with nested array and object
expect({ a: { b: [1, 2] }}).to.have.shape({ a: { b: [1] }})
```