jest-traceable
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Traceable

Object tagging for your tests

Before

Before

After

After

How to use

import traceable from "jest-traceable"

test(`Displays turn winner`, () => {
	// Tag objects
	const winner = traceable(makeWinner(), "winner")
	const looser = traceable(makeLooser(), "looser")

	// Some code
	const ui = { notifyWinner: jest.fn() }
	const game = new Game(ui)

	game.turn(winner, looser)

	// Verify object passing
	expect(ui.notifyWinner).toHaveBeenCalledWith(winner)
})

Full example

Package Sidebar

Install

npm i jest-traceable

Weekly Downloads

1

Version

0.3.0

License

MIT

Unpacked Size

10.5 kB

Total Files

16

Last publish

Collaborators

  • isthatcentered