-
Notifications
You must be signed in to change notification settings - Fork 3
feat(reaclette): Reset state by effect test #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/new.spec.js
Outdated
effects: { | ||
async foo() { | ||
this.state.qux = "baz"; | ||
this.resetState(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await
!
src/new.spec.js
Outdated
}, | ||
}); | ||
return effects.foo(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge with context test.
src/new.spec.js
Outdated
expect(ownProps(this.effects)).toEqual(["myEffect", "_setState"]); | ||
|
||
expect(typeof this.resetState).toBe("function"); | ||
this.state.myEntry = "thud"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is necessary to test the state before resetState
!
You can move this after the state tests below.
src/new.spec.js
Outdated
this.state.myEntry = "baz"; | ||
expect(this.state.myEntry).toBe("baz"); | ||
|
||
expect(typeof this.resetState).toBe("function"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary because you are already calling it.
src/new.spec.js
Outdated
expect(this.state.myEntry).toBe("baz"); | ||
|
||
expect(typeof this.resetState).toBe("function"); | ||
this.state.myEntry = "thud"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of this if it has already been changed to baz
?
No description provided.