Class TestResultPassed<T, TS>

A passed test result. This should not be constructed manually. Instead, testPass should be used.

Type Parameters

  • T
  • TS

Constructors

Properties

sideData: TS
value: T

Methods

  • Get the value of the passed test, or undefined if the test failed.

    Returns T

  • Get the failure message callback of the failed test, or undefined if the test passed.

    Returns undefined

  • Get the value of the passed test, or throw an error if the test failed.

    Returns T

  • For passed tests, map the passed value to another value. Failed tests will remain unchanged.

    This will not mutate the test result, and instead return a new test result.

    Type Parameters

    • T2

    Parameters

    • mapper: ((value: T, sideData: TS) => T2)

      A function that will transform the passed value.

        • (value, sideData): T2
        • Parameters

          • value: T
          • sideData: TS

          Returns T2

    Returns TestResultPassed<T2, TS>

  • For passed tests, asynchronously map the passed value to another value. Failed tests will remain unchanged.

    This will not mutate the test result, and instead return a new test result.

    Type Parameters

    • T2

    Parameters

    • mapper: ((value: T, sideData: TS) => Promise<T2>)

      A function that will transform the passed value.

        • (value, sideData): Promise<T2>
        • Parameters

          • value: T
          • sideData: TS

          Returns Promise<T2>

    Returns Promise<TestResultPassed<T2, TS>>