@kayahr/assert
    Preparing search index...

    Function assertNotThrow

    • Asserts that given asynchronous function does not reject the returned promise.

      Parameters

      • fn: () => Promise<unknown>

        The function to call.

      • Optionalerror: unknown

        Optional error to compare thrown exception to. If specified then assertion fails when function does throw an exception equal to this one. If not specified then assertion fails when function throws anything.

      • Optionalreason: string

        Optional reason added to exception message when assertion fails.

      Returns Promise<void>

      Promise which must be awaited in order to complete assertion.

      AssertionError when function throws exception matching the given one (or any exception when no error specified).

    • Asserts that given function does not throw an exception.

      Parameters

      • fn: () => unknown

        The function to call.

      • Optionalerror: unknown

        Optional error to compare thrown exception to. If specified then assertion fails when function does throw an exception equal to this one. If not specified then assertion fails when function throws anything.

      • Optionalreason: string

        Optional reason added to exception message when assertion fails.

      Returns void

      AssertionError when function throws exception matching the given one (or any exception when no error specified).