@nevware21/tripwire - v0.1.8
    Preparing search index...

    Function decreasesByFunc

    Export assertion functions

    • Asserts that executing the target function decreases the monitored value by a specific delta. Unlike changesByFunc, the value must actually decrease. Note: The delta should be specified as a positive value representing the magnitude of the decrease. For example, if a value goes from 10 to 7, use delta of 3, not -3.

      Type Parameters

      • R
      • T = any

      Parameters

      • this: IAssertScope

        The current IAssertScope object

      • getter: T | (() => any)

        A function that returns a value to monitor, or an object containing the property to monitor

      • Optionalprop: keyof T

        The property name to monitor (only used when first argument is an object)

      • Optionaldelta: number | MsgSource

        The expected decrease amount (should be a positive number representing the magnitude)

      • OptionalevalMsg: MsgSource

        Optional message to display if the assertion fails

      Returns R

      The current IAssertScope.that object

      let count = 10;
      const getCount = () => count;
      const subtractThree = () => { count -= 3; };

      expect(subtractThree).to.decreaseBy(getCount, 3); // Passes - decreased by 3 (use positive 3, not -3)