Skip to content

Commit

Permalink
Merge branch '1.0.0' into 1002-fix-register-delegate-integration-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Jul 19, 2018
2 parents ccde1b7 + e73c7cc commit 42b58d8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
4 changes: 3 additions & 1 deletion src/components/login/login.js
Expand Up @@ -124,7 +124,9 @@ class Login extends React.Component {
...validator(value, error),
});

this.props.settingsUpdated({ [name]: value });
if (name === 'network') {
this.props.settingsUpdated({ network: value });
}
}

onFormSubmit(event) {
Expand Down
2 changes: 1 addition & 1 deletion src/testFiles.js
Expand Up @@ -192,7 +192,7 @@ export const integrationTestsDict = [
// './login.test.js',
// './register.test.js',
// './registerDelegate.test.js',
'./transactionID.test.js',
// './transactionID.test.js',
// './voting.test.js',
'./wallet.test.js',
];
40 changes: 24 additions & 16 deletions test/integration/transactionID.test.js
Expand Up @@ -4,8 +4,8 @@ import { expect } from 'chai';
import { mount } from 'enzyme';
import { stub, match } from 'sinon';

import * as peers from '../../src/utils/api/peers';
import * as accountAPI from '../../src/utils/api/account';
import * as transactionsAPI from '../../src/utils/api/transactions';
import { prepareStore, renderWithRouter } from '../utils/applicationInit';
import accountReducer from '../../src/store/reducers/account';
import transactionReducer from '../../src/store/reducers/transaction';
Expand All @@ -24,43 +24,51 @@ import GenericStepDefinition from '../utils/genericStepDefinition';

class Helper extends GenericStepDefinition {
checkTxDetails() {
expect(this.wrapper.find('.transaction-id').first().text()).to.contain('123456789');
expect(this.wrapper.find('#sender-address').first().text()).to.contain('123l');
expect(this.wrapper).to.have.descendants('.transaction-id');
expect(this.wrapper.find('.transaction-id').first()).to.include.text('123456789');
expect(this.wrapper).to.have.descendants('#sender-address');
expect(this.wrapper.find('#sender-address').first()).to.include.text('123l');
}
}

describe('@integration: Single Transaction', () => {
let store;
let helper;
let wrapper;
let requestToActivePeerStub;
let accountAPIStub;
let transactionAPIStub;
let getTransactionsAPIStub;
let getSingleTransactionAPIStub;

beforeEach(() => {
requestToActivePeerStub = stub(peers, 'requestToActivePeer');
transactionAPIStub = stub(accountAPI, 'transaction');
getTransactionsAPIStub = stub(transactionsAPI, 'getTransactions');
getSingleTransactionAPIStub = stub(transactionsAPI, 'getSingleTransaction');
accountAPIStub = stub(accountAPI, 'getAccount');

transactionAPIStub
getTransactionsAPIStub
.returnsPromise()
.resolves({
transaction: {
id: '123456789', senderId: '123l', recipientId: '456l', votes: { added: [], deleted: [] },
},
data: [{
id: '123456789',
senderId: '123l',
recipientId: '456l',
asset: {
votes: { added: [], deleted: [] },
},
}],
});

requestToActivePeerStub.withArgs(match.any, 'transactions/get', { id: '123456789' })
getSingleTransactionAPIStub
.returnsPromise()
.resolves({
success: true,
transaction: { id: '123456789', senderId: '123l', recipientId: '456l' },
data: [{
id: '123456789', senderId: '123l', recipientId: '456l', asset: {},
}],
});
});

afterEach(() => {
requestToActivePeerStub.restore();
transactionAPIStub.restore();
getTransactionsAPIStub.restore();
getSingleTransactionAPIStub.restore();
accountAPIStub.restore();
wrapper.update();
});
Expand Down

0 comments on commit 42b58d8

Please sign in to comment.