aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/selectors/tests/custom-gas.test.js
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2019-02-27 02:30:41 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2019-02-27 02:30:41 +0800
commita2320c76fef084b7ec01839ab9c17b474839b3c0 (patch)
tree7620668c68c0de4e0de6ef745beb2cdc508ff50b /ui/app/selectors/tests/custom-gas.test.js
parentfc1655eecbf3da969dc9c9a8fc3ae95221ffa30b (diff)
downloadtangerine-wallet-browser-a2320c76fef084b7ec01839ab9c17b474839b3c0.tar
tangerine-wallet-browser-a2320c76fef084b7ec01839ab9c17b474839b3c0.tar.gz
tangerine-wallet-browser-a2320c76fef084b7ec01839ab9c17b474839b3c0.tar.bz2
tangerine-wallet-browser-a2320c76fef084b7ec01839ab9c17b474839b3c0.tar.lz
tangerine-wallet-browser-a2320c76fef084b7ec01839ab9c17b474839b3c0.tar.xz
tangerine-wallet-browser-a2320c76fef084b7ec01839ab9c17b474839b3c0.tar.zst
tangerine-wallet-browser-a2320c76fef084b7ec01839ab9c17b474839b3c0.zip
Show/Hide Fiat on Testnets based on User Preference (#6153)
Diffstat (limited to 'ui/app/selectors/tests/custom-gas.test.js')
-rw-r--r--ui/app/selectors/tests/custom-gas.test.js345
1 files changed, 333 insertions, 12 deletions
diff --git a/ui/app/selectors/tests/custom-gas.test.js b/ui/app/selectors/tests/custom-gas.test.js
index 0776ac4d0..73240d997 100644
--- a/ui/app/selectors/tests/custom-gas.test.js
+++ b/ui/app/selectors/tests/custom-gas.test.js
@@ -78,22 +78,22 @@ describe('custom-gas selectors', () => {
expectedResult: [
{
labelKey: 'slow',
- feeInPrimaryCurrency: '$0.01',
- feeInSecondaryCurrency: '0.0000525 ETH',
+ feeInSecondaryCurrency: '$0.01',
+ feeInPrimaryCurrency: '0.0000525 ETH',
timeEstimate: '~6 min 36 sec',
priceInHexWei: '0x9502f900',
},
{
labelKey: 'average',
- feeInPrimaryCurrency: '$0.03',
- feeInSecondaryCurrency: '0.000105 ETH',
+ feeInSecondaryCurrency: '$0.03',
+ feeInPrimaryCurrency: '0.000105 ETH',
timeEstimate: '~3 min 18 sec',
priceInHexWei: '0x12a05f200',
},
{
labelKey: 'fast',
- feeInPrimaryCurrency: '$0.05',
- feeInSecondaryCurrency: '0.00021 ETH',
+ feeInSecondaryCurrency: '$0.05',
+ feeInPrimaryCurrency: '0.00021 ETH',
timeEstimate: '~30 sec',
priceInHexWei: '0x2540be400',
},
@@ -102,6 +102,12 @@ describe('custom-gas selectors', () => {
metamask: {
conversionRate: 255.71,
currentCurrency: 'usd',
+ preferences: {
+ showFiatInTestnets: false,
+ },
+ provider: {
+ type: 'mainnet',
+ },
},
gas: {
basicEstimates: {
@@ -120,22 +126,22 @@ describe('custom-gas selectors', () => {
expectedResult: [
{
labelKey: 'slow',
- feeInPrimaryCurrency: '$0.27',
- feeInSecondaryCurrency: '0.000105 ETH',
+ feeInSecondaryCurrency: '$0.27',
+ feeInPrimaryCurrency: '0.000105 ETH',
timeEstimate: '~13 min 12 sec',
priceInHexWei: '0x12a05f200',
},
{
labelKey: 'average',
- feeInPrimaryCurrency: '$0.54',
- feeInSecondaryCurrency: '0.00021 ETH',
+ feeInSecondaryCurrency: '$0.54',
+ feeInPrimaryCurrency: '0.00021 ETH',
timeEstimate: '~6 min 36 sec',
priceInHexWei: '0x2540be400',
},
{
labelKey: 'fast',
- feeInPrimaryCurrency: '$1.07',
- feeInSecondaryCurrency: '0.00042 ETH',
+ feeInSecondaryCurrency: '$1.07',
+ feeInPrimaryCurrency: '0.00042 ETH',
timeEstimate: '~1 min',
priceInHexWei: '0x4a817c800',
},
@@ -147,6 +153,165 @@ describe('custom-gas selectors', () => {
send: {
gasLimit: '0x5208',
},
+ preferences: {
+ showFiatInTestnets: false,
+ },
+ provider: {
+ type: 'mainnet',
+ },
+ },
+ gas: {
+ basicEstimates: {
+ blockTime: 14.16326530612245,
+ safeLow: 5,
+ safeLowWait: 13.2,
+ fast: 10,
+ fastWait: 6.6,
+ fastest: 20,
+ fastestWait: 1.0,
+ },
+ },
+ },
+ },
+ {
+ expectedResult: [
+ {
+ labelKey: 'slow',
+ feeInSecondaryCurrency: '',
+ feeInPrimaryCurrency: '0.000105 ETH',
+ timeEstimate: '~13 min 12 sec',
+ priceInHexWei: '0x12a05f200',
+ },
+ {
+ labelKey: 'average',
+ feeInSecondaryCurrency: '',
+ feeInPrimaryCurrency: '0.00021 ETH',
+ timeEstimate: '~6 min 36 sec',
+ priceInHexWei: '0x2540be400',
+ },
+ {
+ labelKey: 'fast',
+ feeInSecondaryCurrency: '',
+ feeInPrimaryCurrency: '0.00042 ETH',
+ timeEstimate: '~1 min',
+ priceInHexWei: '0x4a817c800',
+ },
+ ],
+ mockState: {
+ metamask: {
+ conversionRate: 2557.1,
+ currentCurrency: 'usd',
+ send: {
+ gasLimit: '0x5208',
+ },
+ preferences: {
+ showFiatInTestnets: false,
+ },
+ provider: {
+ type: 'rinkeby',
+ },
+ },
+ gas: {
+ basicEstimates: {
+ blockTime: 14.16326530612245,
+ safeLow: 5,
+ safeLowWait: 13.2,
+ fast: 10,
+ fastWait: 6.6,
+ fastest: 20,
+ fastestWait: 1.0,
+ },
+ },
+ },
+ },
+ {
+ expectedResult: [
+ {
+ labelKey: 'slow',
+ feeInSecondaryCurrency: '$0.27',
+ feeInPrimaryCurrency: '0.000105 ETH',
+ timeEstimate: '~13 min 12 sec',
+ priceInHexWei: '0x12a05f200',
+ },
+ {
+ labelKey: 'average',
+ feeInSecondaryCurrency: '$0.54',
+ feeInPrimaryCurrency: '0.00021 ETH',
+ timeEstimate: '~6 min 36 sec',
+ priceInHexWei: '0x2540be400',
+ },
+ {
+ labelKey: 'fast',
+ feeInSecondaryCurrency: '$1.07',
+ feeInPrimaryCurrency: '0.00042 ETH',
+ timeEstimate: '~1 min',
+ priceInHexWei: '0x4a817c800',
+ },
+ ],
+ mockState: {
+ metamask: {
+ conversionRate: 2557.1,
+ currentCurrency: 'usd',
+ send: {
+ gasLimit: '0x5208',
+ },
+ preferences: {
+ showFiatInTestnets: true,
+ },
+ provider: {
+ type: 'rinkeby',
+ },
+ },
+ gas: {
+ basicEstimates: {
+ blockTime: 14.16326530612245,
+ safeLow: 5,
+ safeLowWait: 13.2,
+ fast: 10,
+ fastWait: 6.6,
+ fastest: 20,
+ fastestWait: 1.0,
+ },
+ },
+ },
+ },
+ {
+ expectedResult: [
+ {
+ labelKey: 'slow',
+ feeInSecondaryCurrency: '$0.27',
+ feeInPrimaryCurrency: '0.000105 ETH',
+ timeEstimate: '~13 min 12 sec',
+ priceInHexWei: '0x12a05f200',
+ },
+ {
+ labelKey: 'average',
+ feeInSecondaryCurrency: '$0.54',
+ feeInPrimaryCurrency: '0.00021 ETH',
+ timeEstimate: '~6 min 36 sec',
+ priceInHexWei: '0x2540be400',
+ },
+ {
+ labelKey: 'fast',
+ feeInSecondaryCurrency: '$1.07',
+ feeInPrimaryCurrency: '0.00042 ETH',
+ timeEstimate: '~1 min',
+ priceInHexWei: '0x4a817c800',
+ },
+ ],
+ mockState: {
+ metamask: {
+ conversionRate: 2557.1,
+ currentCurrency: 'usd',
+ send: {
+ gasLimit: '0x5208',
+ },
+ preferences: {
+ showFiatInTestnets: true,
+ },
+ provider: {
+ type: 'mainnet',
+ },
},
gas: {
basicEstimates: {
@@ -203,6 +368,12 @@ describe('custom-gas selectors', () => {
send: {
gasLimit: '0x5208',
},
+ preferences: {
+ showFiatInTestnets: false,
+ },
+ provider: {
+ type: 'mainnet',
+ },
},
gas: {
basicEstimates: {
@@ -245,6 +416,156 @@ describe('custom-gas selectors', () => {
send: {
gasLimit: '0x5208',
},
+ preferences: {
+ showFiatInTestnets: false,
+ },
+ provider: {
+ type: 'mainnet',
+ },
+ },
+ gas: {
+ basicEstimates: {
+ blockTime: 14.16326530612245,
+ safeLow: 50,
+ safeLowWait: 13.2,
+ fast: 100,
+ fastWait: 6.6,
+ fastest: 200,
+ fastestWait: 1.0,
+ },
+ },
+ },
+ },
+ {
+ expectedResult: [
+ {
+ feeInSecondaryCurrency: '',
+ feeInPrimaryCurrency: '0.00105 ETH',
+ labelKey: 'slow',
+ priceInHexWei: '0xba43b7400',
+ },
+ {
+ feeInSecondaryCurrency: '',
+ feeInPrimaryCurrency: '0.0021 ETH',
+ labelKey: 'average',
+ priceInHexWei: '0x174876e800',
+ },
+ {
+ feeInSecondaryCurrency: '',
+ feeInPrimaryCurrency: '0.0042 ETH',
+ labelKey: 'fast',
+ priceInHexWei: '0x2e90edd000',
+ },
+ ],
+ mockState: {
+ metamask: {
+ conversionRate: 2557.1,
+ currentCurrency: 'usd',
+ send: {
+ gasLimit: '0x5208',
+ },
+ preferences: {
+ showFiatInTestnets: false,
+ },
+ provider: {
+ type: 'rinkeby',
+ },
+ },
+ gas: {
+ basicEstimates: {
+ blockTime: 14.16326530612245,
+ safeLow: 50,
+ safeLowWait: 13.2,
+ fast: 100,
+ fastWait: 6.6,
+ fastest: 200,
+ fastestWait: 1.0,
+ },
+ },
+ },
+ },
+ {
+ expectedResult: [
+ {
+ feeInSecondaryCurrency: '$2.68',
+ feeInPrimaryCurrency: '0.00105 ETH',
+ labelKey: 'slow',
+ priceInHexWei: '0xba43b7400',
+ },
+ {
+ feeInSecondaryCurrency: '$5.37',
+ feeInPrimaryCurrency: '0.0021 ETH',
+ labelKey: 'average',
+ priceInHexWei: '0x174876e800',
+ },
+ {
+ feeInSecondaryCurrency: '$10.74',
+ feeInPrimaryCurrency: '0.0042 ETH',
+ labelKey: 'fast',
+ priceInHexWei: '0x2e90edd000',
+ },
+ ],
+ mockState: {
+ metamask: {
+ conversionRate: 2557.1,
+ currentCurrency: 'usd',
+ send: {
+ gasLimit: '0x5208',
+ },
+ preferences: {
+ showFiatInTestnets: true,
+ },
+ provider: {
+ type: 'rinkeby',
+ },
+ },
+ gas: {
+ basicEstimates: {
+ blockTime: 14.16326530612245,
+ safeLow: 50,
+ safeLowWait: 13.2,
+ fast: 100,
+ fastWait: 6.6,
+ fastest: 200,
+ fastestWait: 1.0,
+ },
+ },
+ },
+ },
+ {
+ expectedResult: [
+ {
+ feeInSecondaryCurrency: '$2.68',
+ feeInPrimaryCurrency: '0.00105 ETH',
+ labelKey: 'slow',
+ priceInHexWei: '0xba43b7400',
+ },
+ {
+ feeInSecondaryCurrency: '$5.37',
+ feeInPrimaryCurrency: '0.0021 ETH',
+ labelKey: 'average',
+ priceInHexWei: '0x174876e800',
+ },
+ {
+ feeInSecondaryCurrency: '$10.74',
+ feeInPrimaryCurrency: '0.0042 ETH',
+ labelKey: 'fast',
+ priceInHexWei: '0x2e90edd000',
+ },
+ ],
+ mockState: {
+ metamask: {
+ conversionRate: 2557.1,
+ currentCurrency: 'usd',
+ send: {
+ gasLimit: '0x5208',
+ },
+ preferences: {
+ showFiatInTestnets: true,
+ },
+ provider: {
+ type: 'mainnet',
+ },
},
gas: {
basicEstimates: {