diff options
author | Thomas Huang <tmashuang@users.noreply.github.com> | 2018-12-12 06:56:47 +0800 |
---|---|---|
committer | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-12-12 06:56:47 +0800 |
commit | 2f5abd9ad8ac64c16edcc0d9fff923e62c5ca984 (patch) | |
tree | 16d323cd3325b1b9121434e86c3047dc333c2b1d /ui/app/selectors/tests | |
parent | ed9bfdcebd5eed1d749f275f9d388ea0dd8f8275 (diff) | |
download | tangerine-wallet-browser-5.2.0.tar tangerine-wallet-browser-5.2.0.tar.gz tangerine-wallet-browser-5.2.0.tar.bz2 tangerine-wallet-browser-5.2.0.tar.lz tangerine-wallet-browser-5.2.0.tar.xz tangerine-wallet-browser-5.2.0.tar.zst tangerine-wallet-browser-5.2.0.zip |
Version Bump (#5909)v5.2.0
* Adds new gas customization modal container (without content)
* Adds the content of the advanced tab - w/o chart or dynamic content - to gas customize modal.
* Use correct message key in gas-modal-page-container.component.js
* Use BEM for css in gas-modal-page-container
* Split advanced-tab-content.component.js render() method into smaller pieces; add translations to the same file.
* Remove gas slider from advance-tab-content.component
* Add tests for advanced-tab-component.js and subcomponents.
* Improve styling of advanced-tab-content gasInput row
* Adds basic tab content to gas customizer, with styled button group (static, for now).
* Connect the gas-button-group component to redux and a live api.
* Improvements to propdefaults in button-group.component and basic-tab-content.component
* Styling fixes for gas customization advanced tab content.
* Adds gas-duck.test.js tests.
* Connects remained of the gas customization component to redux.
* Integrate gas buttons with the send screen.
* Test updates and additions for button integration with send screen.
* Adds redesign for the customize gas advanced tab.
* Adds not yet functional gas price chart.
* Gas price chart improvements, redesign, bug fixes, and set up to receive external data
* Read only connection of gas price chart to redux
* Clean up for advanced gas tab customization changes.
* Complete integration of gas chart with redux.
* Add control arrows to advanced gas tab inputs.
* Lint and unit test fixes.
* Clean up gas chart code.
* Update tests, plus some lint fixes, for gas-price-chart
* Improve data management and tests for gas-modal-page-container price estimates.
* Clean up for mmui-i11-custom-gas-price-chart branch
* Redesign of gas customization basic tab.
* Adds createSpeedUpTransaction to txController
* Connect gas price chart to gas station api.
* Adds speed up slide-in gas customization sidebar
* Update e2e tests for new gas customization modal.
* Fixes for components that break e2e gas customization tests, plus unit test updates.
* Remove gas customization integration tests (in favour of e2e tests)
* Add gas data to integration test json data set.
* Add c3 and d3 to the separate dependencies bundle.
* Make gas customization modal responsive.
* Fix "fastest" translation message; change to sentence case
* Uses more reliable api on main send screen; caches basic api results in modal
* Add loading spinners when waiting for APIs in the gas customization modal
* Modify results of API data to better fit gas chart: remove outliers, pad data
* Clear custom gas data on hiding of gas customization modal.
* Improve responsiveness of customize speed up slider.
* Final gas customization fixes
* Fix styling of send screen in extension view when hex data on.
* Replace height: 100% rule with workaround for flexbox quirks
* Fill in more Polish message translations
* Update lockfile to fix errors
npm has informed me that the lockfile has "errors":
npm ERR! code ELOCKVERIFY
npm ERR! Errors were found in your package-lock.json, run npm install to fix them.
npm ERR! Missing: c3@^0.6.7
npm ERR! Invalid: lock file's d3@3.5.17 does not satisfy d3@^5.7.0
* circleci: Disable npm audit when installing packages
Auditing packages when installing here doesn't help anyone as the summary
isn't visible and vulnerabilities don't produce a non-zero exit code. We
will have `npm audit` as an extra CI job.
* npm audit fix
* circleci: Replace nsp with npm audit
Refs #4751
* Remove beefy dependency and its usages
Refs #4768
Refs #5389
This changeset removes the beefy package that:
1. Was last published 2 yrs ago
2. Brought with it 1 moderate and 1 critical vulnerability
3. Was only used in scripts that no longer work
* npm uninstall open
* Update ganache-core to mitigate vuln
=== npm audit security report ===
> # Run npm install --save-dev ganache-core@2.3.1 to resolve 1 vulnerability
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Memory Exposure │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ bl │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ ganache-core [dev] │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ ganache-core > level-sublevel > levelup > bl │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://nodesecurity.io/advisories/596 │
└───────────────┴──────────────────────────────────────────────────────────────┘
* Deduplicate package.json file
From `npm install`:
> npm WARN The package css-loader is included as both a dev and production dependency.
> npm WARN The package eslint-plugin-react is included as both a dev and production dependency.
> npm WARN The package file-loader is included as both a dev and production dependency.
> npm WARN The package gulp is included as both a dev and production dependency.
It's also worth noting that the Gulp version we were using was inconsistent and there is
a published v4 release on GitHub.
* Fix race condition in network controller lookup() method.
* Group transactions by nonce (#5886)
* fix formatting of 32-byte strings in personal_sign (#5878)
* Bump json-rpc-engine to v4.0.0
* Bump package lock, mostly to https links
* Improve ux for low gas price set (#5862)
* Show user warning if they set gas price below safelow minimum, error if 0.
* Properly cache basic price estimate data.
* Default retry price to recommended price if original price was 0x0
* Use mock fetch in send-new-ui integration tests.
* Show Failed transaction in the browser notification for on-chain failures (#5904)
* Changelog and version bump for 5.2.0
Diffstat (limited to 'ui/app/selectors/tests')
-rw-r--r-- | ui/app/selectors/tests/custom-gas.test.js | 277 |
1 files changed, 277 insertions, 0 deletions
diff --git a/ui/app/selectors/tests/custom-gas.test.js b/ui/app/selectors/tests/custom-gas.test.js new file mode 100644 index 000000000..ebc300160 --- /dev/null +++ b/ui/app/selectors/tests/custom-gas.test.js @@ -0,0 +1,277 @@ +import assert from 'assert' +import proxyquire from 'proxyquire' + +const { + getCustomGasErrors, + getCustomGasLimit, + getCustomGasPrice, + getCustomGasTotal, + getEstimatedGasPrices, + getEstimatedGasTimes, + getPriceAndTimeEstimates, + getRenderableBasicEstimateData, + getRenderableEstimateDataForSmallButtonsFromGWEI, +} = proxyquire('../custom-gas', {}) + +describe('custom-gas selectors', () => { + + describe('getCustomGasPrice()', () => { + it('should return gas.customData.price', () => { + const mockState = { gas: { customData: { price: 'mockPrice' } } } + assert.equal(getCustomGasPrice(mockState), 'mockPrice') + }) + }) + + describe('getCustomGasLimit()', () => { + it('should return gas.customData.limit', () => { + const mockState = { gas: { customData: { limit: 'mockLimit' } } } + assert.equal(getCustomGasLimit(mockState), 'mockLimit') + }) + }) + + describe('getCustomGasTotal()', () => { + it('should return gas.customData.total', () => { + const mockState = { gas: { customData: { total: 'mockTotal' } } } + assert.equal(getCustomGasTotal(mockState), 'mockTotal') + }) + }) + + describe('getCustomGasErrors()', () => { + it('should return gas.errors', () => { + const mockState = { gas: { errors: 'mockErrors' } } + assert.equal(getCustomGasErrors(mockState), 'mockErrors') + }) + }) + + describe('getPriceAndTimeEstimates', () => { + it('should return price and time estimates', () => { + const mockState = { gas: { priceAndTimeEstimates: 'mockPriceAndTimeEstimates' } } + assert.equal(getPriceAndTimeEstimates(mockState), 'mockPriceAndTimeEstimates') + }) + }) + + describe('getEstimatedGasPrices', () => { + it('should return price and time estimates', () => { + const mockState = { gas: { priceAndTimeEstimates: [ + { gasprice: 12, somethingElse: 20 }, + { gasprice: 22, expectedTime: 30 }, + { gasprice: 32, somethingElse: 40 }, + ] } } + assert.deepEqual(getEstimatedGasPrices(mockState), [12, 22, 32]) + }) + }) + + describe('getEstimatedGasTimes', () => { + it('should return price and time estimates', () => { + const mockState = { gas: { priceAndTimeEstimates: [ + { somethingElse: 12, expectedTime: 20 }, + { gasPrice: 22, expectedTime: 30 }, + { somethingElse: 32, expectedTime: 40 }, + ] } } + assert.deepEqual(getEstimatedGasTimes(mockState), [20, 30, 40]) + }) + }) + + describe('getRenderableBasicEstimateData()', () => { + const tests = [ + { + expectedResult: [ + { + labelKey: 'fastest', + feeInPrimaryCurrency: '$0.05', + feeInSecondaryCurrency: '0.00021 ETH', + timeEstimate: '~30 sec', + priceInHexWei: '0x2540be400', + }, + { + labelKey: 'fast', + feeInPrimaryCurrency: '$0.03', + feeInSecondaryCurrency: '0.000105 ETH', + timeEstimate: '~3 min 18 sec', + priceInHexWei: '0x12a05f200', + }, + { + labelKey: 'slow', + feeInPrimaryCurrency: '$0.01', + feeInSecondaryCurrency: '0.0000525 ETH', + timeEstimate: '~6 min 36 sec', + priceInHexWei: '0x9502f900', + }, + ], + mockState: { + metamask: { + conversionRate: 255.71, + currentCurrency: 'usd', + send: { + gasLimit: '0x5208', + }, + }, + gas: { + basicEstimates: { + blockTime: 14.16326530612245, + safeLow: 2.5, + safeLowWait: 6.6, + fast: 5, + fastWait: 3.3, + fastest: 10, + fastestWait: 0.5, + }, + }, + }, + }, + { + expectedResult: [ + { + labelKey: 'fastest', + feeInPrimaryCurrency: '$1.07', + feeInSecondaryCurrency: '0.00042 ETH', + timeEstimate: '~1 min', + priceInHexWei: '0x4a817c800', + }, + { + labelKey: 'fast', + feeInPrimaryCurrency: '$0.54', + feeInSecondaryCurrency: '0.00021 ETH', + timeEstimate: '~6 min 36 sec', + priceInHexWei: '0x2540be400', + }, + { + labelKey: 'slow', + feeInPrimaryCurrency: '$0.27', + feeInSecondaryCurrency: '0.000105 ETH', + timeEstimate: '~13 min 12 sec', + priceInHexWei: '0x12a05f200', + }, + ], + mockState: { + metamask: { + conversionRate: 2557.1, + currentCurrency: 'usd', + send: { + gasLimit: '0x5208', + }, + }, + gas: { + basicEstimates: { + blockTime: 14.16326530612245, + safeLow: 5, + safeLowWait: 13.2, + fast: 10, + fastWait: 6.6, + fastest: 20, + fastestWait: 1.0, + }, + }, + }, + }, + ] + it('should return renderable data about basic estimates', () => { + tests.forEach(test => { + assert.deepEqual( + getRenderableBasicEstimateData(test.mockState), + test.expectedResult + ) + }) + }) + + }) + + describe('getRenderableEstimateDataForSmallButtonsFromGWEI()', () => { + const tests = [ + { + expectedResult: [ + { + feeInSecondaryCurrency: '$0.54', + feeInPrimaryCurrency: '0.0021 ETH', + labelKey: 'fastest', + priceInHexWei: '0x174876e800', + }, + { + feeInSecondaryCurrency: '$0.27', + feeInPrimaryCurrency: '0.00105 ETH', + labelKey: 'fast', + priceInHexWei: '0xba43b7400', + }, + { + feeInSecondaryCurrency: '$0.13', + feeInPrimaryCurrency: '0.00052 ETH', + labelKey: 'slow', + priceInHexWei: '0x5d21dba00', + }, + ], + mockState: { + metamask: { + conversionRate: 255.71, + currentCurrency: 'usd', + send: { + gasLimit: '0x5208', + }, + }, + gas: { + basicEstimates: { + blockTime: 14.16326530612245, + safeLow: 25, + safeLowWait: 6.6, + fast: 50, + fastWait: 3.3, + fastest: 100, + fastestWait: 0.5, + }, + }, + }, + }, + { + expectedResult: [ + { + feeInSecondaryCurrency: '$10.74', + feeInPrimaryCurrency: '0.0042 ETH', + labelKey: 'fastest', + priceInHexWei: '0x2e90edd000', + }, + { + feeInSecondaryCurrency: '$5.37', + feeInPrimaryCurrency: '0.0021 ETH', + labelKey: 'fast', + priceInHexWei: '0x174876e800', + }, + { + feeInSecondaryCurrency: '$2.68', + feeInPrimaryCurrency: '0.00105 ETH', + labelKey: 'slow', + priceInHexWei: '0xba43b7400', + }, + ], + mockState: { + metamask: { + conversionRate: 2557.1, + currentCurrency: 'usd', + send: { + gasLimit: '0x5208', + }, + }, + gas: { + basicEstimates: { + blockTime: 14.16326530612245, + safeLow: 50, + safeLowWait: 13.2, + fast: 100, + fastWait: 6.6, + fastest: 200, + fastestWait: 1.0, + }, + }, + }, + }, + ] + it('should return renderable data about basic estimates appropriate for buttons with less info', () => { + tests.forEach(test => { + assert.deepEqual( + getRenderableEstimateDataForSmallButtonsFromGWEI(test.mockState), + test.expectedResult + ) + }) + }) + + }) + +}) |