good day.
im testing to see function got all her args.
i know what value two of her args must have,
but for the third arg, i just want to test if it exists.
expect(myFunction).toHaveBeenCalledWithMatcher({
a: 1,
b: 2,
c: dont know its val but want it to exist
});
thanks in advance
You can also use jasmine.any
. In case you expect a number it could be:
expect(myFunction).toHaveBeenCalledWith({
a: 1,
b: 2,
c: jasmine.any(Number)
});
It is also possible jasmine.any(Function)
and so on. From Jasmine doc:
jasmine.any takes a constructor or “class” name as an expected value. It returns true if the constructor matches the constructor of the actual value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With