0

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.

dman
  • 10,406
  • 18
  • 102
  • 201

1 Answers1

1

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);
daKmoR
  • 1,774
  • 12
  • 24