0.3.0 • Published 4 years ago
jest-traceable v0.3.0
Traceable
Object tagging for your tests
Before
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)
})