-
Notifications
You must be signed in to change notification settings - Fork 23
Update badge #232
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
Update badge #232
Conversation
| dispatch(updateLabelSuccess(label)); | ||
| } | ||
| } catch (e) { | ||
| // To do |
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.
you should really start working on a general error handler instead of sprinkling todos all over your codebase
| it('should update label: less badge', () => { | ||
| const data = Map({ | ||
| [labels[0].id]: Map({ | ||
| id: labels[0].id, |
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 const firstLabel = labels[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.
In the test I don't mind if it is the first, second, whatever label.... it just take a label to test.
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.
so what?it is still repetitive. use const [anyLabel] = labels
| }); | ||
| const action = actions.updateLabelSuccess({ id: 1, badgeOperation: -1 }); | ||
| const state = labelReducer(data, action); | ||
| expect(state).toMatchSnapshot(); |
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.
dont abuse snapshots, the expect API has more appropriate methods for this
| const action = actions.updateLabelSuccess({ id: 1, badgeOperation }); | ||
| const state = labelReducer(data, action); | ||
| expect(state.get('1').get('badge')).toEqual( | ||
| data.get('1').get('badge') + badgeOperation |
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 hard to read. why not use expect toEqual arrayContaining expectedBadge.
| it('should update label: less badge', () => { | ||
| const data = Map({ | ||
| [labels[0].id]: Map({ | ||
| id: labels[0].id, |
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.
so what?it is still repetitive. use const [anyLabel] = labels
No description provided.