-
Notifications
You must be signed in to change notification settings - Fork 96
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
Increase test coverage - Closes #535 #570
Conversation
@@ -31,4 +32,11 @@ describe('RegisterHOC', () => { | |||
it('should render Register', () => { | |||
expect(wrapper.find('Register')).to.have.lengthOf(1); | |||
}); | |||
|
|||
it('should bind dialogDisplayed action to Register props.dialogDisplayed', () => { |
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.
setActiveDialog
is no longer used in register component, so it can be removed and this test too.
src/components/login/index.test.js
Outdated
actionsSpy.restore(); | ||
}); | ||
|
||
it('should bind dialogDisplayed action to Login props.dialogDisplayed', () => { |
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.
setActiveDialog
is no longer used in login component, so it can be removed and this test too.
expect(wrapper.find('Search input').props().value).to.equal(''); | ||
wrapper.find('Search').props().history.push('/explorer/transaciton/123'); | ||
wrapper.update(); | ||
expect(wrapper.find('Search input').props().value).to.equal('123'); |
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 https://github.com/producthunt/chai-enzyme#propskey-val as it gives better error messages.
Also applicable for other tests in this file.
it('should change value on "change" event', () => { | ||
wrapper.find('Search input').simulate('change', { target: { value: '12025' } }); | ||
expect(wrapper.find('Search input').props().value).to.equal('12025'); | ||
}); |
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.
Is this duplicate to the previous test case?
}); | ||
|
||
it('should render Search', () => { | ||
expect(wrapper.find('.search-bar-input')).to.have.lengthOf(1); |
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.
}); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(translate()(Send)); | ||
export default connect(mapStateToProps)(translate()(Send)); |
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.
Good catch!
<Provider store={{}}> | ||
<Router> | ||
<Sidechains {...props} /> | ||
</Router> |
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.
withRouter(..)
in the component seems unnecessary as well as <Router>
and <Provider>
here
<Sidechains {...props} /> | ||
</Router> | ||
</Provider>, options); | ||
expect(wrapper.find('Sidechains')).to.have.lengthOf(1); |
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 kind of assertion makes sense for a HOC, but not here.
Try rather something like expect(wrapper.find('h2')).to.have.text('Coming soon.')
And then update it(...
accordingly.
peers: {}, | ||
}; | ||
const wrapper = shallow(<TransactionOverview {...props} />); | ||
expect(wrapper.find('Waypoint')).to.have.length(1); |
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.
karma.conf.js
Outdated
@@ -101,6 +89,9 @@ module.exports = function (config) { | |||
'src/components/mainMenu/mainMenu.js', | |||
'src/components/setting/setting.js', | |||
'src/components/votesPreview/index.js', | |||
'src/components/register/index.js', |
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 file has some tests added below. Does it still need to be here?
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.
2ecd61a
to
f625a73
Compare
When you are removing the vote dialog autocomplete, you can also remove this as it is not used anywhere else https://github.com/LiskHQ/lisk-hub/blob/75b19d63db0141750da5a62f9f7be8e37fd1c05a/src/utils/api/delegate.js#L23-L41 |
b698097
to
80a5db7
Compare
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.
Good job, Mike.
Increase test coverage - Closes #535
What was the problem?
Low test coverage
How did I fix it?
Increase test coverage
How to test it?
Run tests to check if coverage is above 80%
Review checklist