Skip to content

Commit

Permalink
Merge pull request #881 from chronologic/develop
Browse files Browse the repository at this point in the history
Update master to 1.1.6
  • Loading branch information
josipbagaric authored Nov 16, 2018
2 parents f6839ec + 2f3b7ed commit 228dbb0
Show file tree
Hide file tree
Showing 24 changed files with 568 additions and 262 deletions.
46 changes: 46 additions & 0 deletions __mocks__/EacServiceMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export const MOCKED_TRANSACTIONS = [
'0x123306090abab3a6e1400e9345bc60c78a8bef57',
'0x456306090abab3a6e1400e9345bc60c78a8bef57'
];

export const eacService = {
calcEndowment(num) {
return num;
},
getActiveContracts: () => {
return {};
},
requestFactory: () =>
Promise.resolve({
getRequestCreatedLogs() {
return MOCKED_TRANSACTIONS.map(tx => ({
args: {
request: tx,
params: []
}
}));
}
}),
scheduler: () => Promise.resolve({}),

transactionRequest(address) {
return {
address
};
},
getTransactionsEventsForAddresses() {
return {};
},
Util: {
getBlockNumber() {
return 1;
},
getTimestampForBlock: () => 123
},
RequestData() {
return {};
},
getTotalEthTransferred: () => {
return 1000;
}
};
49 changes: 5 additions & 44 deletions __tests__/App.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import DateTimeValidator from '../app/stores/DateTimeValidatorStore';
import LocalStorageService from '../app/services/storage';
import LocalStorageMock from '../__mocks__/LocalStorageMock';
import TokenHelper from '../app/services/token-helper';
import EacStore from '../app/stores/EacStore';
import { eacService, MOCKED_TRANSACTIONS } from '../__mocks__/EacServiceMock';

momentDurationFormatSetup(moment);

Expand All @@ -25,11 +27,6 @@ describe('App', () => {
it('correctly navigates when clicking links', async () => {
const TEST_EXPLORER = 'https://etherscan.io/';

const MOCKED_TRANSACTIONS = [
'0x123306090abab3a6e1400e9345bc60c78a8bef57',
'0x456306090abab3a6e1400e9345bc60c78a8bef57'
];

const web3Service = new Web3Service({
eth: {
accounts: []
Expand Down Expand Up @@ -70,45 +67,6 @@ describe('App', () => {
init: () => Promise.resolve(true)
});

const eacService = {
calcEndowment(num) {
return num;
},
getActiveContracts: () => {
return {};
},
requestFactory: () =>
Promise.resolve({
getRequestCreatedLogs() {
return MOCKED_TRANSACTIONS.map(tx => ({
args: {
request: tx,
params: []
}
}));
}
}),
scheduler: () => Promise.resolve({}),

transactionRequest(address) {
return {
address
};
},
getTransactionsEventsForAddresses() {
return {};
},
Util: {
getBlockNumber() {
return 1;
},
getTimestampForBlock: () => 123
},
RequestData() {
return {};
}
};

const TRANSACTIONS_LENGTH = 20;

const TRANSACTIONS = [];
Expand Down Expand Up @@ -180,9 +138,12 @@ describe('App', () => {

const transactionStatistics = {};

const eacStore = new EacStore(eacService, featuresService, web3Service);

const injectables = {
dateTimeValidatorStore,
eacService,
eacStore,
featuresService,
keenStore,
scheduleStore,
Expand Down
13 changes: 6 additions & 7 deletions __tests__/Header.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import LocalStorageService from '../app/services/storage';
import LocalStorageMock from '../__mocks__/LocalStorageMock';
import TimeNodeStore from '../app/stores/TimeNodeStore';
import { KOVAN_NETWORK_ID } from '../app/config/web3Config';
import EacStore from '../app/stores/EacStore';
import { eacService } from '../__mocks__/EacServiceMock';

const browserHistory = createBrowserHistory();
const routingStore = new RouterStore();
Expand Down Expand Up @@ -42,24 +44,21 @@ describe('Header', () => {
});

const keenStore = {};
const eacService = {
getActiveContracts: () => {
return {};
}
};
const featuresService = {};

const storageService = new LocalStorageService(new LocalStorageMock());
const timeNodeStore = new TimeNodeStore({}, web3Service, {}, storageService);
const transactionStatistics = {};

const eacStore = new EacStore(eacService, featuresService, web3Service);

const injectables = {
featuresService,
keenStore,
storageService,
web3Service,
eacService,
timeNodeStore,
eacStore,
transactionStatistics
};

Expand Down Expand Up @@ -87,7 +86,7 @@ describe('Header', () => {
.html()
.trim()
).toBe(
`<div data-test="network-display"><span class="active-timenodes"><i class="fa fa-th-large"></i>&nbsp;Network:&nbsp;</span><span class="timenode-count"><span>Kovan at #${CURRENT_BLOCK}</span></span></div>`
`<div data-test="network-display" class="header-item"><span class="analytics-name"><i class="fa fa-th-large"></i>&nbsp;Network:&nbsp;</span><span class="analytics-count"><span>Kovan at #${CURRENT_BLOCK}</span></span></div>`
);

mockedRender.unmount();
Expand Down
6 changes: 6 additions & 0 deletions __tests__/SidePanel.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { RouterStore, syncHistoryWithStore } from 'mobx-react-router';
import TimeNodeStore from '../app/stores/TimeNodeStore';
import LocalStorageMock from '../__mocks__/LocalStorageMock';
import LocalStorageService from '../app/services/storage';
import EacStore from '../app/stores/EacStore';
import { eacService } from '../__mocks__/EacServiceMock';

const browserHistory = createBrowserHistory();
const routingStore = new RouterStore();
Expand All @@ -31,12 +33,16 @@ describe('SidePanel', () => {

const keenStore = {};
const transactionStatistics = {};
const featuresService = {};

const localStorageMock = new LocalStorageMock();
const storageService = new LocalStorageService(localStorageMock);
const timeNodeStore = new TimeNodeStore({}, {}, {}, storageService);

const eacStore = new EacStore(eacService, featuresService, web3Service);

const injectables = {
eacStore,
keenStore,
timeNodeStore,
transactionStatistics,
Expand Down
4 changes: 4 additions & 0 deletions __tests__/TransactionDetails.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import BigNumber from 'bignumber.js';
import TransactionDetails from '../app/components/TransactionScanner/TransactionDetails';
import { TransactionStore } from '../app/stores/TransactionStore';
import TokenHelper from '../app/services/token-helper';
import LoadingStateStore from '../app/stores/LoadingStateStore';

describe('TransactionDetails', () => {
it('correctly renders', async () => {
Expand Down Expand Up @@ -56,8 +57,11 @@ describe('TransactionDetails', () => {
const transactionStore = new TransactionStore(eacService, web3Service);
const tokenHelper = new TokenHelper(web3Service);

const loadingStateStore = new LoadingStateStore(web3Service, {}, transactionStore);

const injectables = {
eacService,
loadingStateStore,
tokenHelper,
transactionStore,
web3Service
Expand Down
4 changes: 4 additions & 0 deletions __tests__/TransactionScanner.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { TRANSACTIONS_TABLE_TEST_ATTRS } from '../app/components/TransactionScan
import { TRANSACTION_SCANNER_LIMIT } from '../app/components/TransactionScanner/TransactionScanner';
import TransactionHelper from '../app/services/transaction-helper';
import BucketHelper from '../app/services/bucket-helper';
import LoadingStateStore from '../app/stores/LoadingStateStore';

momentDurationFormatSetup(moment);

Expand Down Expand Up @@ -173,8 +174,11 @@ describe('TransactionScanner', () => {
bucketHelper
);

const loadingStateStore = new LoadingStateStore(web3Service, featuresService, transactionStore);

const injectables = {
eacService,
loadingStateStore,
transactionStore,
web3Service
};
Expand Down
33 changes: 30 additions & 3 deletions __tests__/__snapshots__/SidePanel.unit.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ exports[`SidePanel is correctly rendered 1`] = `
<div
className="sidebar-additional-item--label"
>
Active TimeNodes
Transferred
</div>
<div
className="sidebar-additional-item--display"
Expand All @@ -249,8 +249,21 @@ exports[`SidePanel is correctly rendered 1`] = `
className="css-1ncsqv2"
/>
</div>
 ETH
</div>
</li>
<li
className="sidebar-additional-item"
>
<div
className="sidebar-additional-item--label"
>
Active TimeNodes
</div>
<div
className="sidebar-additional-item--display"
/>
</li>
<li
className="sidebar-additional-item"
>
Expand All @@ -277,7 +290,21 @@ exports[`SidePanel is correctly rendered 1`] = `
</div>
<div
className="sidebar-additional-item--display"
/>
>
<div
className=""
>
<div
className="css-1ncsqv2"
/>
<div
className="css-o7y5po"
/>
<div
className="css-1ncsqv2"
/>
</div>
</div>
</li>
<li
className="sidebar-additional-item"
Expand All @@ -302,7 +329,7 @@ exports[`SidePanel is correctly rendered 1`] = `
<div
className="sidebar-additional-item--display"
>
undefined%
 %
</div>
</li>
</ul>
Expand Down
22 changes: 22 additions & 0 deletions app/components/Common/InformativeLoader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { inject, observer } from 'mobx-react';

@inject('loadingStateStore')
@observer
class InformativeLoader extends Component {
render() {
return (
<div className="text-center">
<b>{this.props.loadingStateStore.progress}%</b>{' '}
{this.props.loadingStateStore.loadingMessage}
</div>
);
}
}

InformativeLoader.propTypes = {
loadingStateStore: PropTypes.any
};

export default InformativeLoader;
Loading

0 comments on commit 228dbb0

Please sign in to comment.