Skip to main content

Promise

.toResolve()

Use .toResolve when checking if a promise is resolved.

test('passes when a promise resolves', async () => {
  await expect(Promise.resolve()).toResolve();
});

Open browser consoleTests

.toReject()

Use .toReject when checking if a promise is rejected.

test('passes when a promise rejects', async () => {
  await expect(Promise.reject()).toReject();
});

Open browser consoleTests