You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make whats happening a bit more explicit. Currently there's a bit of magic.
Let you use your own sinon rather than rely on reagent using its own.
letspy;describe('MyComponent',()=>{beforeEach(){spy=reagent.spyLifecycle(sinon,MyComponent);},it('should do things',()=>{constmy=mount(<MyComponent/>);my.setProps({hello: 'world'});assert.isTrue(spy.get('componentWillReceiveProps').calledOnce,'receive props was called');// or if we don't want to be stringly typed...assert.isTrue(my.componentWillReceiveProps.calledOnce);});afterEach(){spy.destroy();}});
Pros: It's more explicit what's happening.
Cons: You now have to do the beforeEach/afterEach setup yourself.
Ideally we'd merge spyLifecycle and spyMethods so it just spies every method.
The text was updated successfully, but these errors were encountered:
the spies would attach themselves to the prototype, so you would be able to retrieve them from: MyComponent.prototype.componentWillReceiveProps.calledOnce
lol... so you want to make the spying way more verbose, but then you complain about typing out .prototype? :)
also the my.componentWillReceiveProps.calledOnce won't work. We'd need to do my.instance().componentWillReceiveProps.calledOnce right now unless we added something to the ReactWrapper prototype
The goal of this is to
Pros: It's more explicit what's happening.
Cons: You now have to do the beforeEach/afterEach setup yourself.
Ideally we'd merge spyLifecycle and spyMethods so it just spies every method.
The text was updated successfully, but these errors were encountered: