aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDan Finlay <542863+danfinlay@users.noreply.github.com>2018-01-09 03:21:41 +0800
committerGitHub <noreply@github.com>2018-01-09 03:21:41 +0800
commitd11ec81f49328d3f0fee484fba5191d4c29c42ad (patch)
tree1d888a0e26cb5cf224b8c5a0c1a9bd67e6ae3f1b /test
parent39b700bf87f213d2fb06dcde85f4e6173a6ce70c (diff)
parentf6f3f915707a2a4f5c9db43ae51741c7d30cbc69 (diff)
downloadtangerine-wallet-browser-d11ec81f49328d3f0fee484fba5191d4c29c42ad.tar
tangerine-wallet-browser-d11ec81f49328d3f0fee484fba5191d4c29c42ad.tar.gz
tangerine-wallet-browser-d11ec81f49328d3f0fee484fba5191d4c29c42ad.tar.bz2
tangerine-wallet-browser-d11ec81f49328d3f0fee484fba5191d4c29c42ad.tar.lz
tangerine-wallet-browser-d11ec81f49328d3f0fee484fba5191d4c29c42ad.tar.xz
tangerine-wallet-browser-d11ec81f49328d3f0fee484fba5191d4c29c42ad.tar.zst
tangerine-wallet-browser-d11ec81f49328d3f0fee484fba5191d4c29c42ad.zip
Merge branch 'master' into i2621-0xRecipientAddress
Diffstat (limited to 'test')
-rw-r--r--test/unit/metamask-controller-test.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js
index fd420a70f..3deb5a1c7 100644
--- a/test/unit/metamask-controller-test.js
+++ b/test/unit/metamask-controller-test.js
@@ -3,6 +3,8 @@ const sinon = require('sinon')
const clone = require('clone')
const MetaMaskController = require('../../app/scripts/metamask-controller')
const firstTimeState = require('../../app/scripts/first-time-state')
+const BN = require('ethereumjs-util').BN
+const GWEI_BN = new BN('1000000000')
describe('MetaMaskController', function () {
const noop = () => {}
@@ -45,6 +47,31 @@ describe('MetaMaskController', function () {
metamaskController.keyringController.createNewVaultAndKeychain.restore()
})
+ describe('#getGasPrice', function () {
+ it('gives the 50th percentile lowest accepted gas price from recentBlocksController', async function () {
+ const realRecentBlocksController = metamaskController.recentBlocksController
+ metamaskController.recentBlocksController = {
+ store: {
+ getState: () => {
+ return {
+ recentBlocks: [
+ { gasPrices: [ '0x3b9aca00', '0x174876e800'] },
+ { gasPrices: [ '0x3b9aca00', '0x174876e800'] },
+ { gasPrices: [ '0x174876e800', '0x174876e800' ]},
+ { gasPrices: [ '0x174876e800', '0x174876e800' ]},
+ ]
+ }
+ }
+ }
+ }
+
+ const gasPrice = metamaskController.getGasPrice()
+ assert.equal(gasPrice, '0x3b9aca00', 'accurately estimates 50th percentile accepted gas price')
+
+ metamaskController.recentBlocksController = realRecentBlocksController
+ })
+ })
+
describe('#createNewVaultAndKeychain', function () {
it('can only create new vault on keyringController once', async function () {