Reputation: 1872
With great thanks to those that so swiftly rescued me. The essence of the problem was that I failed to realize I should be looking in documentation for "matchers", and looking in "expect" was not going to solve my problem.
I'm working with Jasmine 3.0 (and very new to it!) and trying to verify that a spy sees zero calls to a target under particular conditions. I thought I might use the count()
behavior for this, but I'm struggling to work out what syntax I should use.
I've tried
spyOn(target, 'action').and.callThrough();
target.triggeringAction();
expect(target.action).count().toBe(0);
But Jasmine reports TypeError: expect(...).count is not a function
.
I don't see any expect(...).toNotHaveBeenCalled()
and I'm not sure where to look next.
Upvotes: 2
Views: 552
Reputation: 156
This could work as well expect(target.action).not.toHaveBeenCalled();
Upvotes: 1
Reputation: 8491
You could use expect(target.action).toHaveBeenCalledTimes(0);
Upvotes: 3