Skip to content

Commit

Permalink
♻️ Account, followdAccount, loadingBar, login middlewares migrarion i…
Browse files Browse the repository at this point in the history
…ntegration tests
  • Loading branch information
michaeltomasik committed Jul 23, 2018
1 parent 397128d commit fcb2459
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
5 changes: 5 additions & 0 deletions src/store/middlewares/account.test.js
Expand Up @@ -98,6 +98,7 @@ describe('Account middleware', () => {
transactions: state.transactions,
};

clock.tick(7000);
expect(accountDataUpdatedSpy).to.have.been.calledWith(data);
expect(accountActions.updateTransactionsIfNeeded).to.have.been.calledWith();
accountDataUpdatedSpy.restore();
Expand All @@ -116,6 +117,8 @@ describe('Account middleware', () => {
});

middleware(store)(next)(newBlockCreated);

clock.tick(7000);
expect(accountDataUpdatedSpy).to.have.been.calledWith();
accountDataUpdatedSpy.restore();
});
Expand All @@ -134,6 +137,8 @@ describe('Account middleware', () => {
});

middleware(store)(next)(newBlockCreated);

clock.tick(7000);
expect(accountDataUpdatedSpy).to.have.been.calledWith();
accountDataUpdatedSpy.restore();
});
Expand Down
15 changes: 4 additions & 11 deletions src/store/middlewares/login.test.js
Expand Up @@ -4,9 +4,12 @@ import Lisk from 'lisk-elements';
import accounts from '../../../test/constants/accounts';
import middleware from './login';
import actionTypes from '../../constants/actions';
import networks from '../../constants/networks';
import * as accountApi from '../../utils/api/account';
import * as delegateApi from '../../utils/api/delegate';

// TODO: Check if tests that includes activePeerSet are still relevant

describe('Login middleware', () => {
let store;
let next;
Expand Down Expand Up @@ -51,6 +54,7 @@ describe('Login middleware', () => {
data: {
passphrase,
activePeer: Lisk.APIClient,
options: { code: networks.mainnet.code, address: accounts.genesis.address },
},
};

Expand All @@ -72,17 +76,6 @@ describe('Login middleware', () => {
expect(next).to.have.been.calledWith(sampleAction);
});

it(`should action data to only have activePeer on ${actionTypes.activePeerSet} action`, () => {
middleware(store)(next)(activePeerSetAction);
expect(next).to.have.been.calledWith({
type: actionTypes.activePeerSet,
data: {
passphrase,
activePeer: Lisk.APIClient,
},
});
});

it(`should fetch account and delegate info on ${actionTypes.activePeerSet} action (non delegate)`, () => {
accountApiMock.resolves({ success: true, data: { balance: 0 } });
delegateApiMock.rejects({ success: false });
Expand Down
14 changes: 7 additions & 7 deletions src/testFiles.js
Expand Up @@ -155,20 +155,20 @@ export const unitTestsDict = [
// './store/middlewares/offline.test.js',
// './store/middlewares/notification.test.js',
// './store/middlewares/voting.test.js',
'./store/middlewares/account.test.js',
'./store/middlewares/followedAccounts.test.js',
// './store/middlewares/account.test.js',
// './store/middlewares/followedAccounts.test.js',
// './store/middlewares/peers.test.js',
'./store/middlewares/loadingBar.test.js',
'./store/middlewares/login.test.js',
// './store/middlewares/loadingBar.test.js',
// './store/middlewares/login.test.js',
'./store/subscribers/savedAccounts.test.js',
'./store/subscribers/followedAccounts.test.js',
// './store/subscribers/followedAccounts.test.js',
// './store/reducers/search.test.js',
// './store/reducers/savedAccounts.test.js',
'./store/reducers/dialog.test.js',
// './store/reducers/voting.test.js',
'./store/reducers/account.test.js',
// './store/reducers/account.test.js',
// './store/reducers/loding.test.js',
'./store/reducers/followedAccounts.test.js',
// './store/reducers/followedAccounts.test.js',
// './store/reducers/transactions.test.js',
// './store/reducers/peers.test.js',
// './store/reducers/toater.test.js',
Expand Down

0 comments on commit fcb2459

Please sign in to comment.