-
Notifications
You must be signed in to change notification settings - Fork 60
Review and improve React unit test coverage - Closes #531 #601
Conversation
balance: 1e8, | ||
}; | ||
}; | ||
}); | ||
|
||
it(' should render 3 article tags', () => { |
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 remove the extra space character before should.
afterEach(() => { | ||
accountApiMock.restore(); | ||
}); | ||
|
||
it('should be called once', () => { | ||
const actionSpy = spy(AccountComponent.prototype, 'componentDidMount'); |
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 don't need to test 'componentDidMount' because it is part of React and it always runs.You should test functions that call inside the 'componentDidMount'.
|
||
it('calls props.onActivePeerUpdated', () => { | ||
accountApiMock.expects('getAccountStatus').resolves({ success: true }); | ||
const wrapper = mount(<Provider store={store}><AccountComponent {...props} /></Provider>); |
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 defined wrapper but you never used it. If it is extra, you need to remove it.
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.
There is an eslint error in signMessageComponent.test.js and you need to improve test coverage of App component.
import sinonChai from 'sinon-chai'; | ||
import { shallow, mount } from 'enzyme'; | ||
import { Provider } from 'react-redux'; | ||
import * as accountApi from '../../utils/api/account'; |
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 defined 'accountApi' and 'sinon' and 'mock' but you didn't use them. please remove them.
Test coverage is increased to 90%.
There is more room for improving coverage, but there are already over 400 changed lines, so it's worth reviewing and merging. There can be another similar issue opened in the future.
Closes #531