Reputation: 11064
Using Polymer 1.* and webcomponent tester...
I have spy(alert, 'open')
and expect(alert.open).to.have.not.been.called;
. How can I assert a function is not called? Right now this. If I inverse it with expect(alert.open).to.have.been.called;
, it also fails.
I tried .calledCount(0)
and it defaults to has not been called
which fails.
The spy is good, it's just complaining ether way that it is not asserted and test fails.
Upvotes: 0
Views: 135
Reputation: 1864
You should expect on the spy itself
const myElement = fixture('my-element');
const openSpy = sinon.spy(myElement, 'open');
//myElement.doSomethingThatShouldNotTriggerOpen();
openSpy.should.have.callCount(0);
Upvotes: 1