# @smartesting/assert-contain-exactly

> Simple test helper ensuring a list contains exactly the expected elements, without taking care of order.

Latest version **0.1.4** (published 2023-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @smartesting/assert-contain-exactly
pnpm add @smartesting/assert-contain-exactly
yarn add @smartesting/assert-contain-exactly
bun add @smartesting/assert-contain-exactly
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2023-01-18 |
| First published | 2023-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Smartesting |
| Maintainers | jracenet, admin-smartesting, smart-rfe, c.grandpierre, vincentpsmartesting, yakaldir, aymerictn |
| Keywords | test, assertion |

## Links

- npm: https://www.npmjs.com/package/@smartesting/assert-contain-exactly
- Repository: https://github.com/Smartesting/assert-contain-exactly
- Homepage: https://github.com/Smartesting/assert-contain-exactly#readme
- Issues: https://github.com/Smartesting/assert-contain-exactly/issues
- npm.io page: https://npm.io/package/@smartesting/assert-contain-exactly

## 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

- 0.1.4 (latest) — 2023-01-18
- 0.1.3 — 2023-01-18
- 0.1.1 — 2023-01-18

## README

# @smartesting/assert-contain-exactly

[![Node.js CI](https://github.com/Smartesting/assert-contain-exactly/actions/workflows/node.js.yml/badge.svg)](https://github.com/Smartesting/assert-contain-exactly/actions/workflows/node.js.yml)

Simple test helper ensuring a list contains exactly the expected elements, without taking care of order. It is strongly inspired by [Rspec's `contain_exactly` matcher](https://relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/contain-exactly-matcher).

## Install

```shell
npm i --save-dev @smartesting/assert-contain-exactly
```

## Usage

```typescript
import assertContainExactly from "@smartesting/assert-contain-exactly";

const expected = ["a", "b", "c"];
const actual = getItems();
assertContainExactly(actual, expected);
```

When the arrays `actual` and `expected`, nothing happens. Otherwise, an exception is thrown and the message should help you spot the differences between the two arrays:

```
Error: Expected arrays to contain the same objects.
Missing elements were: [
  {
    id: "session-2",
    buildId: "13"
  }
]
Extra elements were: [
  {
    id: "session-B",
    buildId: "13"
  }
]
    at assertIncludesExactly (...)

```

## Notes

This code is meant to be used for testing purposes. The algorithm is not that smart not designed to handle arrays with hundred of items.

---
_Source: https://npm.io/package/@smartesting/assert-contain-exactly · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
