-
Notifications
You must be signed in to change notification settings - Fork 783
test: add tests for CommentInput #582
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
…point#485) BREAKING CHANGE: Update link script in Package.json
…oid (gitpoint#485)" This reverts commit 282f475.
* feat(markdown): Add support for quoted emails * fix: use paddingHorizontal instead of Left and Right
…#493) * refactor: Drop rn-app-intro in favor of react-native-swiper * fix: Don't embed swiper in a View, so that it works on Android
* Spanish file (first translation) * Languague related files * Fix * Replaced double quotes * Improved spanish translation * Minor improvements (spanish translation) * Some improvements (spanish translation) The GIT reserved words are kept without translate. * Removed english phrase * Updated analytics title * Updated spanish translation * Added missing fields (spanish translation) * Replaced tabs (spanish translation) * Changed some words to downcase (spanish translation)
* feat(issue_events): Show events on issues * style(issue_events): Added styles to "added label" event * style(issue_events): Add icon & improve styling of added labels * style(issue_events): Improve <ReviewRequested /> styles * feat(issue_events): Remove mentioned/subscribed events from UI * feat(issue_events): Define <Closed /> events * refactor(issue_events): Extract <EventIcon /> and <Date /> * feat(issue_events): Add `unlabled` prop to <Labeled /> * feat(issue_events): Define <Merged /> event * feat(issue_events): Filter out `closed` events preceded by `merged` * feat(issue_events): Define <HeadRef /> events * feat(issue_events): Define <Assigned /> events * feat(issue_events): Define <Reopened /> & <Renamed /> events * refactor(issue_events): Render <Text /> from <ActorLink /> * style(issue_events): Trim issue names to ensure spacing * feat(issue_events): Define <Locked /> event * feat(issue_events): Define <Milestoned /> event * refactor(issue_events): Clean up authUser from LabeledComponent * feat(issue_events): Define <MarkedAsDuplicate /> event * refactor(issue_events): Define generic <Event /> component * docs(readme): Add @brandly as a contributor * feat(issue_events): Define <LabelGroup /> for list of label changes * refactor(issue_events): Use spread operator for textChildren * style(issue_events): Add blank line after external imports * feat(issue_events): <InlineLabel /> has rounded corners * refactor(issue_events): Move <InlineLabel /> into own file * feat(issue_events): Press username in events to view profile * refactor(events): Inline most <Event />s into <IssueEventListItem /> * refactor(events): Eliminate <Date /> since its only used once * refactor(events): Extract formatEventsToRender into event-helpers
Adds back button when AuthProfileScreen is not the root of a StackNavigator. Ps. AuthProfileScreen is StackNavigator root when the routeName is MyProfile.
…nt badges + change user click o (gitpoint#516)
* chore(fonts): Not link all fonts from react-native-vector-icons * fix(fonts): Add the missing Menlo * fix(cli): Fix for RN 0.48 * chore(cli): Run `yarn run link` again
…int#510) Convert notification-icon.component.js to use styled-components as part of gitpoint#503
gitpoint#509) Converted the label-list-item component styles to styled-components
Converted view-container.component.js to use styled components BREAKING CHANGE: none none
* test: begin implementing tests * test: add more tests * test: add Buton and Badge tests * test: add StateBadge test * test: only import used enzyme wrappers * chore(deps): update table component to 1.1.0 * test: Add tests for ToggleView * Update ToggleView.js
…point#485) BREAKING CHANGE: Update link script in Package.json
…oid (gitpoint#485)" This reverts commit 282f475.
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.
Please use lower case to start sentences in it statements. Also, can you run this through prettier? It should have done it by default but I'm guessing your environment isn't setup correctly.
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.
Just some tiny wording stuff
onSubmit: () => {}, | ||
}; | ||
|
||
it('should render TextInput and TouchableOpacity if I can post', () => { |
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.
Use 3rd person. 'should render TextInput and TouchableOpacity if user has post permissions'
expect(wrapper.find('Text').length).toEqual(0); | ||
}); | ||
|
||
it("should not render TextInput and TouchableOpacity if I can't post", () => { |
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.
Use 3rd person. 'should not render TextInput and TouchableOpacity if user does not have post permissions'
expect(wrapper.find('Text').length).toEqual(1); | ||
}); | ||
|
||
it('should update the state text if value changed', () => { |
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.
'should update the state text if value is changed'
expect(wrapper.state('text')).toEqual('Changed text'); | ||
}); | ||
|
||
it('should call handleSubmit methods when submitted', () => { |
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.
'should call handleSubmit method when submitted'
expect(wrapper.state('height')).toBe(10); | ||
}); | ||
|
||
it('should call handleSubmitEditing methods when onSubmitEditing event raised', () => { |
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.
'should call handleSubmitEditing method when onSubmitEditing event is raised'
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.
@dyesseyumba 'should call handleSubmitEditing method in Android when onSubmitEditing event is raised'
. Please also mention the platform.
Add two more cases for userHasPushPermission and issueLocked. Update test to use migrated components to styled-components.
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.
Looks good after the changes requested by @chinesedfan
@dyesseyumba Thanks for your updates. Please notice that more components were introduced, but you didn't update test descriptions. It is better to only test one component or some related components in each test case. |
@chinesedfan I'm a little lost about new components. Those components are not the olds components styled with You right about to only test one component. I added unnecessary assertions for child components. I'll fix that. |
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.
@dyesseyumba Sorry about my words made you confused. "new components" just means other components except for "TextInput" and "TouchableOpacity".
expect(wrapper.find('Styled(TextInput)').length).toEqual(1); | ||
expect(wrapper.find('Styled(TouchableOpacity)').length).toEqual(1); | ||
expect(wrapper.find('Styled(PostButtonIcon)').length).toEqual(1); | ||
expect(wrapper.find('Styled(Text)').length).toEqual(0); |
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.
The description didn't mention "Styled(PostButtonIcon)" and "Styled(Text)". They are what I mean "more components".
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.
@dyesseyumba There are still some conflicts between descriptions and implementations. I suggest you to design test cases follow patterns, then no typos will be included completely.
For example, should [not] render <components> if <conditions>
. Make sure "components" covers all components, and for each same "components", their "conditions" cover all possibilities.
expect(wrapper.find('Icon').length).toEqual(0); | ||
}); | ||
|
||
it('should render styled TextInput and styled TouchableOpacity if user does not have post permissions and issue is not locked', () => { |
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.
issue is locked.
expect(wrapper.find('Styled(TouchableOpacity)').length).toEqual(1); | ||
}); | ||
|
||
it('should not render styled Text and icon if user does not have post permissions and issue is not locked', () => { |
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.
issue is locked.
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.
Sorry! You're right, I missed that. I'll take my time.
onSubmit: () => {}, | ||
}; | ||
|
||
it('should render styled TextInput and styled TouchableOpacity if user has post permissions and issue is not locked', () => { |
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.
has push permissions
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.
Can you run prettier on this code? Several things need to be cleaned up and will be done so automatically with prettier.
@andrewda and @alejandronanez I applied all changes you requested but you didn't approve. Is anything wrong with this PR? |
Ping @andrewda and @alejandronanez. Seems good to me now. |
Except the above suggestion by @alejandronanez, everything is OK. But I think it is still acceptable and this PR has been pending for such long time without new feedbacks. So let it be merged! |
Hi, here is the unit test for the component 'CommentInput'.