Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('calls the two handlers with the arguments provided', () => {
const spy1 = sinon.spy();
const spy2 = sinon.spy();
const merged = serialize(spy1, spy2);
// not call handlers in merging phase
expect(spy1).to.have.callCount(0);
expect(spy2).to.have.callCount(0);
merged(...ARGS);
// call handlers when calling merged function
expect(spy1).to.have.callCount(1);
expect(spy1).to.have.calledWithExactly(...ARGS);
expect(spy2).to.have.callCount(1);
expect(spy2).to.have.calledWithExactly(...ARGS);
});
beforeEach("replace console.warn with spy", () => {
console.warn = sinon.spy();
});
it('should call all appropriate handlers', () => {
const onMouseDown = sinon.spy();
const onMouseMove = sinon.spy();
const onMouseUp = sinon.spy();
clientRenderer.render(
);
windowStub.simulate('mousedown');
windowStub.simulate('mousemove');
windowStub.simulate('mouseup');
expect(onMouseDown).to.have.been.calledBefore(onMouseMove);
expect(onMouseMove).to.have.been.calledBefore(onMouseUp);
});
it('should call new handler but not the old one', () => {
const originalListener = sinon.spy();
const newListener = sinon.spy();
const fixture = clientRenderer.render(
).result as Fixture;
fixture.setState({listener: newListener});
windowStub.simulate('click');
expect(originalListener).not.to.have.been.called;
expect(newListener).to.have.been.calledOnce;
});
it('called on unmount', () => {
const spy = sinon.spy();
const {container} = clientRenderer.render(<div>);
clientRenderer.render(<div></div>, container);
expect(spy).to.have.callCount(0);
clientRenderer.render(<div>, container);
expect(spy).to.have.callCount(1);
});
});</div></div>
it('invokes the onClick when dropdown label is clicked', () => {
const onClick = sinon.spy();
const {select} = clientRenderer.render();
simulate.click(select(dropDown, input));
return waitFor(() => expect(onClick).to.have.been.calledOnce);
});
beforeEach(() => {
onChange = sinon.spy();
renderer = clientRenderer.render();
});
it('should not have input underhood', function() {
beforeEach("replace console.warn with spy", () => {
_console.warn = sinon.spy();
});
beforeEach(() => {
onChange = sinon.spy();
const rendered = clientRenderer.render(
);
select = rendered.select;
waitForDom = rendered.waitForDom;
});
beforeEach('init Base class', () => {
first = sinon.spy();
last = sinon.spy();
userConstructorSpy = sinon.spy();
});