Test scenario for a matcher.

It tests the matcher in isolation as well as when preceded by .not, with opposite outcomes:

  • one expected to be ✅successful

  • one expected to ❌fail

To run its tests, you'll need to pass:

  1. a subject - via subject(), promiseSubject() or functionSubject()

  2. a matcher and its outcome for the given subject - via ✅passes() or ❌fails()

  3. a failure message for one of the subtests - with a dedicated method for each case

The scenario and is tests are run as soon as the this information is passed.

scenario("when the subject is a number")
.subject(9)
.passes(e => e.toBe(9))
.withErrorWhenNegated("expected 9 not to be 9"); //The last call triggers the tests

Methods

Methods