This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert ShapeShift modal to store (#4035)
* WIP * WIP store * Store in-place * WIP tests * Store completed * Expand option tests for events * Fix & test for errors found in manual testing * Add missing @observer (rookie mistake) * Fix intl formatting error (completed step) * Pass store to ErrorStep, test all stages for components * Add warning messages (e.g. no price found) * Fix typo
- Loading branch information
Showing
17 changed files
with
1,311 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
js/src/modals/Shapeshift/AwaitingDepositStep/awaitingDepositStep.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
import AwaitingDepositStep from './'; | ||
|
||
let component; | ||
|
||
function render () { | ||
component = shallow( | ||
<AwaitingDepositStep | ||
store={ { | ||
coinSymbol: 'BTC', | ||
price: { rate: 0.001, minimum: 0, limit: 1.999 } | ||
} } /> | ||
); | ||
|
||
return component; | ||
} | ||
|
||
describe('modals/Shapeshift/AwaitingDepositStep', () => { | ||
it('renders defaults', () => { | ||
expect(render()).to.be.ok; | ||
}); | ||
|
||
it('displays waiting for address with empty depositAddress', () => { | ||
render(); | ||
expect(component.find('FormattedMessage').props().id).to.match(/awaitingConfirmation/); | ||
}); | ||
|
||
it('displays waiting for deposit with non-empty depositAddress', () => { | ||
render({ depositAddress: 'xyz' }); | ||
expect(component.find('FormattedMessage').first().props().id).to.match(/awaitingDeposit/); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
js/src/modals/Shapeshift/AwaitingExchangeStep/awaitingExchangeStep.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
import AwaitingExchangeStep from './'; | ||
|
||
let component; | ||
|
||
function render () { | ||
component = shallow( | ||
<AwaitingExchangeStep | ||
store={ { | ||
depositInfo: { incomingCoin: 0.01, incomingType: 'BTC' } | ||
} } /> | ||
); | ||
|
||
return component; | ||
} | ||
|
||
describe('modals/Shapeshift/AwaitingExchangeStep', () => { | ||
it('renders defaults', () => { | ||
expect(render()).to.be.ok; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
js/src/modals/Shapeshift/CompletedStep/completedStep.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
import CompletedStep from './'; | ||
|
||
let component; | ||
|
||
function render () { | ||
component = shallow( | ||
<CompletedStep | ||
store={ { | ||
depositInfo: { incomingCoin: 0.01, incomingType: 'BTC' }, | ||
exchangeInfo: { outgoingCoin: 0.1, outgoingType: 'ETH' } | ||
} } /> | ||
); | ||
|
||
return component; | ||
} | ||
|
||
describe('modals/Shapeshift/CompletedStep', () => { | ||
it('renders defaults', () => { | ||
expect(render()).to.be.ok; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
import ErrorStep from './'; | ||
|
||
let component; | ||
|
||
function render () { | ||
component = shallow( | ||
<ErrorStep | ||
store={ { | ||
error: new Error('testing') | ||
} } /> | ||
); | ||
|
||
return component; | ||
} | ||
|
||
describe('modals/Shapeshift/ErrorStep', () => { | ||
it('renders defaults', () => { | ||
expect(render()).to.be.ok; | ||
}); | ||
}); |
Oops, something went wrong.