Readonly
predicateStatic
IsThis factory method returns an expression that matches custom cases.
const value = 'value';
const object = new Mock<Function>()
.setup(instance => instance(It.Is(param => param > 0 && param < 2))
.returns(value)
.object();
const actual = object(only_values_between_0_and_2_will_trigger_the_setup);
expect(actual).toBe(value);
Static
IsThis factory method returns a wildcat expression that matches any value.
const value = 'value';
const object = new Mock<Function>()
.setup(instance => instance(It.IsAny())
.returns(value)
.object();
const actual = object(any_value_will_trigger_the_setup);
expect(actual).toBe(value);
Generated using TypeDoc
This class allows to express wide range of cases in an expression. You can use it with setups or verifies methods.
Example
This class could be used not only for args matching, but also for function names, property names and so on.
Example