Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eduardo-matos/chai-any-eql
https://github.com/eduardo-matos/chai-any-eql
assertion chai node tdd
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/eduardo-matos/chai-any-eql
- Owner: eduardo-matos
- Created: 2017-11-22T13:19:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T04:36:51.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T19:02:17.338Z (about 1 month ago)
- Topics: assertion, chai, node, tdd
- Language: JavaScript
- Size: 164 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# chai-any-eql
[![Build Status](https://travis-ci.org/eduardo-matos/chai-any-eql.svg?branch=master)](https://travis-ci.org/eduardo-matos/chai-any-eql)
[![Coverage Status](https://coveralls.io/repos/github/eduardo-matos/chai-any-eql/badge.svg?branch=master)](https://coveralls.io/github/eduardo-matos/chai-any-eql?branch=master)Allows you to wildcard values.
## Config
```js
const chai = require('chai');
const chaiAnyEql = require('chai-any-eql');chai.use(chaiAnyEql);
```## Assertion
```js
// For any item
expect([1, 2, 3]).to.anyEql([1, chai.ANY, 3]);// On any level
expect({foo: 1, bar: 2}).to.anyEql({foo: 1, bar: chai.ANY});
expect([{ foo: { bar: { baz: 1 } } }]).anyEql([{ foo: chai.ANY }]);
expect([{ foo: { bar: { baz: 1 } } }]).anyEql([{ foo: { bar: chai.ANY } }]);
expect([{ foo: { bar: { baz: 1 } } }]).anyEql([{ foo: { bar: { baz: chai.ANY } } }]);
```Or
```js
expect(1).to.any.eq(chai.ANY);
expect(2).to.any.equal(chai.ANY);
expect([1, 2, 3]).to.any.eql([1, chai.ANY, 3]);
expect({foo: 1, bar: 2}).to.any.eql({foo: 1, bar: chai.ANY});
```