test: add tests for NotificationIcon and RepositorySectionTitle #677
Conversation
|
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 { | |||
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?
Why does this need to be exported? Can you test NotificationIcon which is exported at the bottom of this file?
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.
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.
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
Although exporting and testing the unwrapped Component seems to be recommended by Redux: https://redux.js.org/docs/recipes/WritingTests.html#connected-components
andrewda
Dec 20, 2017
Member
Yep, you're right! This should be exported.
Yep, you're right! This should be exported.
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)
(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)
|
This is so great, thank you so much @ZahraTee :) |
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)