From 943befef91cd725579c4bf4e7024734f02ef98f5 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 8 Jan 2018 15:16:08 -0800 Subject: [PATCH] Add test for gas estimate default --- test/unit/metamask-controller-test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index 9ec7cd0af..3fc7f9a98 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -72,6 +72,25 @@ describe('MetaMaskController', function () { metamaskController.recentBlocksController = realRecentBlocksController }) + + it('gives the 1 gwei price if no blocks have been seen.', async function () { + const realRecentBlocksController = metamaskController.recentBlocksController + metamaskController.recentBlocksController = { + store: { + getState: () => { + return { + recentBlocks: [] + } + } + } + } + + const gasPrice = metamaskController.getGasPrice() + assert.equal(gasPrice, '0x' + GWEI_BN.toString(16), 'defaults to 1 gwei') + + metamaskController.recentBlocksController = realRecentBlocksController + }) + }) describe('#createNewVaultAndKeychain', function () {