Use `expect().toBeDefined()` instead of `.not.toBeUndefined()`.