Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet authored and Gina Contrino committed Mar 13, 2018
1 parent 7235ec0 commit 6b38fd6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/components/dashboard/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Dashboard', () => {
account: { address: 'some address' },
},
};
wrapper = mountWithContext(<Dashboard/>, context);
wrapper = mountWithContext(<Dashboard history={ { location: {} } }/>, context);
});

it('should render transaction list with at most 3 transactions', () => {
Expand Down
1 change: 1 addition & 0 deletions src/components/resultBox/resultBox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('Result Box', () => {
copyToClipboard: () => {},
finalCallback: () => {},
t: () => {},
history: { location: {}, push: () => {} },
};

wrapper = mount(<ResultBox {...props} />, options);
Expand Down
17 changes: 5 additions & 12 deletions src/components/send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,13 @@ import styles from './send.css';
class Send extends React.Component {
constructor(props) {
super(props);
const { address, amount } = parseSearchParams(props.history.location.search);
this.state = {
address,
amount,
sendIsActive: !!address,
sendIsActive: !!this.getSearchParams().address || !!this.getSearchParams().amount,
};
}

componentWillReceiveProps(nextProps) {
const { address, amount } = parseSearchParams(nextProps.history.location);

if (address !== this.state.address || amount !== this.state.amount) {
this.setState({ address, amount });
}
getSearchParams() {
return parseSearchParams(this.props.history.location.search);
}

setSendIsActive(sendIsActive) {
Expand All @@ -54,8 +47,8 @@ class Send extends React.Component {
className={styles.wrapper}>
<SendWritable
autoFocus={this.state.sendIsActive || window.innerWidth > breakpoints.m}
address={this.state.address}
amount={this.state.amount}
address={this.getSearchParams().address}
amount={this.getSearchParams().amount}
/>
<PassphraseSteps />
<SendReadable />
Expand Down
2 changes: 1 addition & 1 deletion src/components/send/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Send', () => {
context = {
storeState,
};
wrapper = mountWithContext(<Send search={''}/>, context);
wrapper = mountWithContext(<Send history={ { location: {} } }/>, context);
});

it('should render MultiStep component ', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/wallet.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('@integration: Wallet', () => {
store.dispatch(activePeerSet({ network: getNetwork(networks.mainnet.code) }));
accountAPIStub.withArgs(match.any).returnsPromise().resolves({ ...account });
store.dispatch(accountLoggedIn(account));
wrapper = mount(renderWithRouter(Wallet, store, { location: { search: '' } }));
wrapper = mount(renderWithRouter(Wallet, store, { history: { location: { search: '' } } }));
helper = new Helper(wrapper, store);
};

Expand Down

0 comments on commit 6b38fd6

Please sign in to comment.