aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js
diff options
context:
space:
mode:
authorDan Finlay <542863+danfinlay@users.noreply.github.com>2019-04-25 03:25:39 +0800
committerGitHub <noreply@github.com>2019-04-25 03:25:39 +0800
commit87d5be9081fd3ab3bfb4ae67d5cab4b8a8304a8a (patch)
tree2230335f440e36c23f47e0794e94cf6b0b312024 /ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js
parent8c98e89e617b594d4f0ee54a8437e30201688090 (diff)
parent6a60562d6649d88f24bd849b325871bb256a0001 (diff)
downloadtangerine-wallet-browser-87d5be9081fd3ab3bfb4ae67d5cab4b8a8304a8a.tar.gz
tangerine-wallet-browser-87d5be9081fd3ab3bfb4ae67d5cab4b8a8304a8a.tar.zst
tangerine-wallet-browser-87d5be9081fd3ab3bfb4ae67d5cab4b8a8304a8a.zip
Merge pull request #6484 from MetaMask/develop
Update master branch with develop (v6.4.0)
Diffstat (limited to 'ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js')
-rw-r--r--ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js b/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js
new file mode 100644
index 000000000..eedd43221
--- /dev/null
+++ b/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js
@@ -0,0 +1,61 @@
+import React from 'react'
+import assert from 'assert'
+import {shallow} from 'enzyme'
+import GasFeeDisplay from '../gas-fee-display.component'
+import UserPreferencedCurrencyDisplay from '../../../../../../components/app/user-preferenced-currency-display'
+import sinon from 'sinon'
+
+
+const propsMethodSpies = {
+ showCustomizeGasModal: sinon.spy(),
+ onReset: sinon.spy(),
+}
+
+describe('GasFeeDisplay Component', function () {
+ let wrapper
+
+ beforeEach(() => {
+ wrapper = shallow(<GasFeeDisplay
+ conversionRate={20}
+ gasTotal={'mockGasTotal'}
+ primaryCurrency={'mockPrimaryCurrency'}
+ convertedCurrency={'mockConvertedCurrency'}
+ showGasButtonGroup={propsMethodSpies.showCustomizeGasModal}
+ onReset={propsMethodSpies.onReset}
+ />, {context: {t: str => str + '_t'}})
+ })
+
+ afterEach(() => {
+ propsMethodSpies.showCustomizeGasModal.resetHistory()
+ })
+
+ describe('render', () => {
+ it('should render a CurrencyDisplay component', () => {
+ assert.equal(wrapper.find(UserPreferencedCurrencyDisplay).length, 2)
+ })
+
+ it('should render the CurrencyDisplay with the correct props', () => {
+ const {
+ type,
+ value,
+ } = wrapper.find(UserPreferencedCurrencyDisplay).at(0).props()
+ assert.equal(type, 'PRIMARY')
+ assert.equal(value, 'mockGasTotal')
+ })
+
+ it('should render the reset button with the correct props', () => {
+ const {
+ onClick,
+ className,
+ } = wrapper.find('button').props()
+ assert.equal(className, 'gas-fee-reset')
+ assert.equal(propsMethodSpies.onReset.callCount, 0)
+ onClick()
+ assert.equal(propsMethodSpies.onReset.callCount, 1)
+ })
+
+ it('should render the reset button with the correct text', () => {
+ assert.equal(wrapper.find('button').text(), 'reset_t')
+ })
+ })
+})