Skip to content
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

test: add tests for NotificationIcon and RepositorySectionTitle #677

Conversation

@ZahraTee
Copy link
Contributor

@ZahraTee ZahraTee commented Dec 20, 2017

Given NotificationIcon is a connected component, I decided just to export and test the undecorated component inside, I can look into testing the connected component too if necessary. There aren't any other examples in the repo yet to indicate what to do in this case. :)

(Part of #518)

@coveralls
Copy link

@coveralls coveralls commented Dec 20, 2017

Coverage Status

Coverage increased (+0.6%) to 40.469% when pulling 3aa67e5 on ZahraTee:tests-repositorySectionTitle-notificationIcon into 4e5235e on gitpoint:master.

Copy link
Member

@andrewda andrewda left a comment

Looks really good, thanks so much!! Just one question:

@@ -20,7 +20,7 @@ const mapStateToProps = state => ({
notificationsCount: state.notifications.notificationsCount,
});

class NotificationIconComponent extends Component {
export class NotificationIconComponent extends Component {

This comment has been minimized.

@andrewda

andrewda Dec 20, 2017
Member

Why does this need to be exported? Can you test NotificationIcon which is exported at the bottom of this file?

This comment has been minimized.

@ZahraTee

ZahraTee Dec 20, 2017
Author Contributor

Given NotificationIcon is this component but connected to a Redux store, the options were to either just test this inner component or to test NotificationIcon itself and mock out the store etc. I can look into the latter option.

This comment has been minimized.

@ZahraTee

ZahraTee Dec 20, 2017
Author Contributor

Although exporting and testing the unwrapped Component seems to be recommended by Redux: https://redux.js.org/docs/recipes/WritingTests.html#connected-components

This comment has been minimized.

@andrewda

andrewda Dec 20, 2017
Member

Yep, you're right! This should be exported.

This comment has been minimized.

@andrewda

andrewda Dec 20, 2017
Member

(not to self: we might want to make this a dumb component w/o access to redux state and do all that state management elsewhere)

Copy link
Member

@housseindjirdeh housseindjirdeh left a comment

This is so great, thank you so much @ZahraTee :)

"contributions": [
"code",
"test"
]

This comment has been minimized.

@housseindjirdeh housseindjirdeh merged commit b0e8bf0 into gitpoint:master Dec 22, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.6%) to 40.469%
Details
@andrewda andrewda mentioned this pull request Dec 1, 2018
31 of 63 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.