.toBeNull()

.toBeNull() is the same as .toBe(null) but the error messages are a bit nicer. So use .toBeNull() when you want to check that something is null.

  1. function bloop() {
  2. return null;
  3. }
  4. test('bloop returns null', () => {
  5. expect(bloop()).toBeNull();
  6. });