It Should Help

General Assertions

The checks that are not tied to one type: boolean-context truthiness, exact absence (undefined/null) on the factory, and definedness on every verifier.

should().true(value)/should().false(value)

Assert how the value behaves in a boolean context. Falsy values are exactly: false, 0, '', null, undefined, and NaN — everything else is truthy.

should().true(15); // ok — numbers other than 0 are truthy should().true('non-empty'); // ok should().false(1 > 4); // ok should().false(0); // ok — 0 is falsy should().false(null); // ok should().true(0); // throws 'The entry expected to be true.'

These are terminal checks (no chaining after them) and have no not form — use the opposite verb instead. Prefer them over expect(Boolean(x)).toBe(true) when the point of the test is the truthiness itself; prefer a specific verifier (string, number) whenever the type is known — the failure messages will say something useful.

should().undefined(value)/should().null(value)

Assert the exact kind of absence. Both compare strictly: undefined() passes only for undefined, null() only for null — neither accepts the other.

should().undefined(missingValue); // ok — passes only for undefined should().null(emptySlot); // ok — passes only for null should().undefined(null); // throws 'The entry expected to be undefined.' should().null(undefined); // throws 'The entry expected to be null.'

Like true()/false() these are terminal checks with no not form. When both null and undefined count as "absent", prefer not.defined() on a verifier (below) — it covers both at once.

defined() — on every verifier

Every verifier — number, string, array, date, objects, method — exposes defined(). It passes when the examined entry is neither null nor undefined and otherwise throws The entry is not defined.. It is also the guard every other check runs implicitly; see Concepts for the interaction with not.

should().string(maybeConfig).defined(); should().array(backendResponse).defined().length(2);

not.defined() is the single legal way a null/undefined entry passes a chain:

should().string(pendingValue).not.defined(); // ok when pendingValue is null/undefined

When to use what

Situation

Use

The type is known

the typed verifier, not true()/false()

Only "is it there" matters

defined()/not.defined()

The exact absence kind matters (undefined vs null)

undefined()/null()

A flag-like result of any type

true()/false()

Next: the typed chapters — Numbers, Strings, Dates, Arrays, Objects, Methods.

16 September 2026