aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_/send-content/send-gas-row/tests
diff options
context:
space:
mode:
authorThomas <thomas.b.huang@gmail.com>2018-07-26 13:38:44 +0800
committerThomas <thomas.b.huang@gmail.com>2018-07-26 13:38:44 +0800
commit138858647ed28a8aaba4b7e18e387ea0b6af0889 (patch)
tree0bc936ee7316112d01e617a246a645e3914da949 /ui/app/components/send_/send-content/send-gas-row/tests
parentfa02a6c7c65f6866998171881fd657570fe3fe7b (diff)
parenta5d344a58223e029dc86bf33a8ca9357492765f3 (diff)
downloadtangerine-wallet-browser-138858647ed28a8aaba4b7e18e387ea0b6af0889.tar.gz
tangerine-wallet-browser-138858647ed28a8aaba4b7e18e387ea0b6af0889.tar.zst
tangerine-wallet-browser-138858647ed28a8aaba4b7e18e387ea0b6af0889.zip
Merge branch 'develop' into network-remove-provider-engine
Diffstat (limited to 'ui/app/components/send_/send-content/send-gas-row/tests')
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js65
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js66
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js22
3 files changed, 0 insertions, 153 deletions
diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js
deleted file mode 100644
index db37f18be..000000000
--- a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import React from 'react'
-import assert from 'assert'
-import { shallow } from 'enzyme'
-import sinon from 'sinon'
-import SendGasRow from '../send-gas-row.component.js'
-
-import SendRowWrapper from '../../send-row-wrapper/send-row-wrapper.component'
-import GasFeeDisplay from '../gas-fee-display/gas-fee-display.component'
-
-const propsMethodSpies = {
- showCustomizeGasModal: sinon.spy(),
-}
-
-describe('SendGasRow Component', function () {
- let wrapper
-
- beforeEach(() => {
- wrapper = shallow(<SendGasRow
- conversionRate={20}
- convertedCurrency={'mockConvertedCurrency'}
- gasLoadingError={false}
- gasTotal={'mockGasTotal'}
- showCustomizeGasModal={propsMethodSpies.showCustomizeGasModal}
- />, { context: { t: str => str + '_t' } })
- })
-
- afterEach(() => {
- propsMethodSpies.showCustomizeGasModal.resetHistory()
- })
-
- describe('render', () => {
- it('should render a SendRowWrapper component', () => {
- assert.equal(wrapper.find(SendRowWrapper).length, 1)
- })
-
- it('should pass the correct props to SendRowWrapper', () => {
- const {
- label,
- } = wrapper.find(SendRowWrapper).props()
-
- assert.equal(label, 'gasFee_t:')
- })
-
- it('should render a GasFeeDisplay as a child of the SendRowWrapper', () => {
- assert(wrapper.find(SendRowWrapper).childAt(0).is(GasFeeDisplay))
- })
-
- it('should render the GasFeeDisplay with the correct props', () => {
- const {
- conversionRate,
- convertedCurrency,
- gasLoadingError,
- gasTotal,
- onClick,
- } = wrapper.find(SendRowWrapper).childAt(0).props()
- assert.equal(conversionRate, 20)
- assert.equal(convertedCurrency, 'mockConvertedCurrency')
- assert.equal(gasLoadingError, false)
- assert.equal(gasTotal, 'mockGasTotal')
- assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 0)
- onClick()
- assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 1)
- })
- })
-})
diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js
deleted file mode 100644
index e928c8aba..000000000
--- a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js
+++ /dev/null
@@ -1,66 +0,0 @@
-import assert from 'assert'
-import proxyquire from 'proxyquire'
-import sinon from 'sinon'
-
-let mapStateToProps
-let mapDispatchToProps
-
-const actionSpies = {
- showModal: sinon.spy(),
-}
-
-proxyquire('../send-gas-row.container.js', {
- 'react-redux': {
- connect: (ms, md) => {
- mapStateToProps = ms
- mapDispatchToProps = md
- return () => ({})
- },
- },
- '../../send.selectors.js': {
- getConversionRate: (s) => `mockConversionRate:${s}`,
- getCurrentCurrency: (s) => `mockConvertedCurrency:${s}`,
- getGasTotal: (s) => `mockGasTotal:${s}`,
- },
- './send-gas-row.selectors.js': { sendGasIsInError: (s) => `mockGasLoadingError:${s}` },
- '../../../../actions': actionSpies,
-})
-
-describe('send-gas-row container', () => {
-
- describe('mapStateToProps()', () => {
-
- it('should map the correct properties to props', () => {
- assert.deepEqual(mapStateToProps('mockState'), {
- conversionRate: 'mockConversionRate:mockState',
- convertedCurrency: 'mockConvertedCurrency:mockState',
- gasTotal: 'mockGasTotal:mockState',
- gasLoadingError: 'mockGasLoadingError:mockState',
- })
- })
-
- })
-
- describe('mapDispatchToProps()', () => {
- let dispatchSpy
- let mapDispatchToPropsObject
-
- beforeEach(() => {
- dispatchSpy = sinon.spy()
- mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy)
- })
-
- describe('showCustomizeGasModal()', () => {
- it('should dispatch an action', () => {
- mapDispatchToPropsObject.showCustomizeGasModal()
- assert(dispatchSpy.calledOnce)
- assert.deepEqual(
- actionSpies.showModal.getCall(0).args[0],
- { name: 'CUSTOMIZE_GAS' }
- )
- })
- })
-
- })
-
-})
diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js
deleted file mode 100644
index a5196334e..000000000
--- a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import assert from 'assert'
-import {
- sendGasIsInError,
-} from '../send-gas-row.selectors.js'
-
-describe('send-gas-row selectors', () => {
-
- describe('sendGasIsInError()', () => {
- it('should return send.errors.gasLoading', () => {
- const state = {
- send: {
- errors: {
- gasLoading: 'abc',
- },
- },
- }
-
- assert.equal(sendGasIsInError(state), 'abc')
- })
- })
-
-})