# chai-spies-augment

> Additions to chai-spies, adding utilities to inspect args and check if a spy was called with a partial object

Latest version **2.1.0** (published 2018-03-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install chai-spies-augment
pnpm add chai-spies-augment
yarn add chai-spies-augment
bun add chai-spies-augment
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2018-03-18 |
| First published | 2018-03-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 63.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Heather Roberts |
| Maintainers | chinchiheather |
| Keywords | chai-spies, chai, testing, automated-testing, unit-testing, spies |

## Links

- npm: https://www.npmjs.com/package/chai-spies-augment
- Repository: https://github.com/chinchiheather/chai-spies-augment
- Homepage: https://github.com/chinchiheather/chai-spies-augment#readme
- Issues: https://github.com/chinchiheather/chai-spies-augment/issues
- npm.io page: https://npm.io/package/chai-spies-augment

## Dependencies (2)

- [chai](https://npm.io/package/chai.md) ^4.1.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.5

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2018-03-18
- 2.0.0 — 2018-03-15
- 1.0.3 — 2018-03-05
- 1.0.2 — 2018-03-04
- 1.0.1 — 2018-03-04
- 1.0.0 — 2018-03-04

## README

# chai-spies-augment
Additions to the [chai-spies](https://github.com/chaijs/chai-spies) library

Adds:
 * Ability to easily inspect the parameters a spy has been called with
 * Ability to check if a spy was called with a partial object

## Install
```bash
npm install --save-dev chai-spies-augment
```

Then in your test setup file where you are loading chai spies
```js
import chaiSpies from 'chai-spies';
import chaiSpiesAugment from 'chai-spies-augment';
...
chai.use(chaiSpies);
chai.use(chaiSpiesAugment);
```

## Usage
### Accessing spy call parameters
```js
const spy = chai.spy();
 
spy(1, 2, 3);
spy('a', 'b', 'c');
 
const args = spy.args(); // ['a', 'b', 'c']
const argsFor = spy.argsFor(0); // [1, 2, 3] 
```
### Checking for partial object

```js
const spy = chai.spy();
 
spy({ a: 'b', c: 'd' });
spy(1, 'a', { b: 'c' });
 
expect(spy).to.have.been.called.with.objectContaining({ a: 'b' }); // true
expect(spy).to.have.been.called.with.objectContaining({ b: 'c' }); // true
```

---
_Source: https://npm.io/package/chai-spies-augment · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
