All Projects → Thinkmill → jest-expect-contain-deep

Thinkmill / jest-expect-contain-deep

Licence: MIT license
Assert deeply nested values in Jest

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to jest-expect-contain-deep

assert
Go 语言 assert 断言函数
Stars: ✭ 17 (-75%)
Mutual labels:  test, assertion
expectest
Crate provides matchers and matcher functions for unit testing.
Stars: ✭ 25 (-63.24%)
Mutual labels:  test, matcher
vue-testing-with-jest-conf17
Examples on how to test Vue with Jest, based on the presentation at VueConf17
Stars: ✭ 37 (-45.59%)
Mutual labels:  test
very good performance
Utility on top of the Flutter Driver API that facilitates measuring the performance of your app in an automated way created by Very Good Ventures 🦄
Stars: ✭ 78 (+14.71%)
Mutual labels:  test
tead
Lighting the way to simpler testing
Stars: ✭ 55 (-19.12%)
Mutual labels:  test
shellmetrics
Cyclomatic Complexity Analyzer for bash, mksh, zsh and POSIX shells
Stars: ✭ 36 (-47.06%)
Mutual labels:  test
playwright-test
Run unit tests with several runners or benchmark inside real browsers with playwright.
Stars: ✭ 81 (+19.12%)
Mutual labels:  test
carina
Carina automation framework: Web, Mobile, API, DB etc testing...
Stars: ✭ 652 (+858.82%)
Mutual labels:  test
scalatest-junit-runner
JUnit 5 runner for Scalatest
Stars: ✭ 30 (-55.88%)
Mutual labels:  test
javascript-assertivo
Um guia fundamental e prático sobre qualidade de código e testes em todas as camadas de uma aplicação JavaScript.
Stars: ✭ 75 (+10.29%)
Mutual labels:  test
framework
Lightweight, open source and magic-free framework for testing solidity smart contracts.
Stars: ✭ 36 (-47.06%)
Mutual labels:  test
unity-test-runner
Run tests for any Unity project
Stars: ✭ 134 (+97.06%)
Mutual labels:  test
PixelTest
Fast, modern, simple iOS snapshot testing written purely in Swift.
Stars: ✭ 56 (-17.65%)
Mutual labels:  test
defaults-deep
Like `extend` but recursively copies only the missing properties/values to the target object.
Stars: ✭ 26 (-61.76%)
Mutual labels:  deep
typescript-test-utils
Helper types for testing your package exported types
Stars: ✭ 16 (-76.47%)
Mutual labels:  test
mint
The very minimum assertion for Golang testing framework.
Stars: ✭ 26 (-61.76%)
Mutual labels:  assertion
mutode
Mutation testing for JavaScript and Node.js
Stars: ✭ 61 (-10.29%)
Mutual labels:  test
Differentia.js
No longer being supported or maintained. A Graph Theory & Data Structure Library for JavaScript.
Stars: ✭ 13 (-80.88%)
Mutual labels:  deep
threat9-test-bed
No description or website provided.
Stars: ✭ 26 (-61.76%)
Mutual labels:  test
patchgirl
Manual reproducible web API tests for web developers
Stars: ✭ 95 (+39.71%)
Mutual labels:  test

jest-expect-contain-deep

Assert deeply nested values in Jest

Installation

yarn add --dev jest-expect-contain-deep

Usage

Before:

const containDeep = require('jest-expect-contain-deep');

test('values', () => {
  let massiveObject = getMassiveObject();
  expect(massiveObject.foo).toBe(expect.arrayContaining([1, 2]));
  expect(massiveObject.bar.prop).toBe(true);
  expect(massiveObject.baz).toContain('bar');
});

test('spies', () => {
  doSomething();
  expect(mySpy.mock.calls[0][0].foo).toBe(expect.arrayContaining([1, 2]));
  expect(mySpy.mock.calls[0][0].bar.prop).toBe(true);
  expect(mySpy.mock.calls[0][0].baz).toContain('bar');
});

After:

const containDeep = require('jest-expect-contain-deep');

test('values', () => {
  expect(getMassiveObject()).toEqual(containDeep({
    foo: [1, 2],
    bar: { prop: true },
    baz: expect.stringContaining('bar'),
  }));
});

test('spies', () => {
  doSomething();
  expect(mySpy).toHaveBeenCalledWith('arg1', containDeep({
    foo: [1, 2],
    bar: { prop: true },
    baz: expect.stringContaining('bar'),
  }));
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].