Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Review and improve React unit test coverage - Closes #531 #601

Merged
merged 20 commits into from
Aug 16, 2017

Conversation

slaweet
Copy link
Contributor

@slaweet slaweet commented Aug 15, 2017

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

balance: 1e8,
};
};
});

it(' should render 3 article tags', () => {
Copy link
Contributor

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');
Copy link
Contributor

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>);
Copy link
Contributor

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.

Copy link
Contributor

@yasharAyari yasharAyari left a 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';
Copy link
Contributor

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.

@slaweet slaweet merged commit 3a44735 into development Aug 16, 2017
@slaweet slaweet deleted the 531-unit-test-coverage branch August 16, 2017 10:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants