ts-playground
    Preparing search index...

    Function assertSameBehavior

    • Assertion utility to verify that two functions exhibit the same behavior.

      Type Parameters

      • Fn extends (...args: Parameters<Fn>) => ReturnType<Fn>

      Parameters

      • fnA: Fn

        The first function to compare.

      • fnB: Fn

        The second function to compare.

      • Optionaloptions: Options<Fn>
        • testFn

          A function to assert the equality of the two function results. (optional) defaults to deep equality check with JSON.stringify

        • errorFn

          A function to call when the two functions produce different results. (optional) defaults to logging error to console

      • ...args: Parameters<Fn>

        The arguments to pass to the functions.

      Returns ReturnType<Fn>

      The result of the first function.