remix/assert · Function

View Source

doesNotReject

Summary

Asserts that the promise returned by fn does not reject.

Signature

function doesNotReject(
  fn: Promise<unknown> | (() => Promise<unknown>),
  expectedErrorOrMessage: unknown,
  message: AssertionMessage,
): Promise<void>

Example

await assert.doesNotReject(() => fetch('/healthy'))

Parameters

fn

A function returning a promise.

expectedErrorOrMessage

Optional error constructor, instance, RegExp, object, validator, or failure message.

message

Optional failure message when expectedErrorOrMessage is an error matcher.