From 13456488ed7f9506fb6e6355c541ec46c415d793 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Mon, 5 Nov 2018 23:17:05 +0100 Subject: [PATCH] refactor: remove unused components --- app/components/CryptoIcon/CryptoIcon.js | 23 ------------ app/components/CryptoIcon/index.js | 3 -- app/components/CurrencyIcon/CurrencyIcon.js | 20 ----------- app/components/CurrencyIcon/index.js | 3 -- test/unit/components/CryptoIcon.spec.js | 39 --------------------- test/unit/components/CurrencyIcon.spec.js | 32 ----------------- 6 files changed, 120 deletions(-) delete mode 100644 app/components/CryptoIcon/CryptoIcon.js delete mode 100644 app/components/CryptoIcon/index.js delete mode 100644 app/components/CurrencyIcon/CurrencyIcon.js delete mode 100644 app/components/CurrencyIcon/index.js delete mode 100644 test/unit/components/CryptoIcon.spec.js delete mode 100644 test/unit/components/CurrencyIcon.spec.js diff --git a/app/components/CryptoIcon/CryptoIcon.js b/app/components/CryptoIcon/CryptoIcon.js deleted file mode 100644 index f34d6008..00000000 --- a/app/components/CryptoIcon/CryptoIcon.js +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' - -import SkinnyBitcoin from 'components/Icon/SkinnyBitcoin' -import Litecoin from 'components/Icon/Litecoin' - -const CryptoIcon = ({ currency, styles }) => { - switch (currency) { - case 'btc': - return - case 'ltc': - return - default: - return - } -} - -CryptoIcon.propTypes = { - currency: PropTypes.string.isRequired, - styles: PropTypes.object -} - -export default CryptoIcon diff --git a/app/components/CryptoIcon/index.js b/app/components/CryptoIcon/index.js deleted file mode 100644 index 13f3d237..00000000 --- a/app/components/CryptoIcon/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import CryptoIcon from './CryptoIcon' - -export default CryptoIcon diff --git a/app/components/CurrencyIcon/CurrencyIcon.js b/app/components/CurrencyIcon/CurrencyIcon.js deleted file mode 100644 index e77d1904..00000000 --- a/app/components/CurrencyIcon/CurrencyIcon.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import FaDollar from 'react-icons/lib/fa/dollar' -import CryptoIcon from '../CryptoIcon' - -const CurrencyIcon = ({ currency, crypto, styles }) => { - return currency === 'usd' ? ( - - ) : ( - - ) -} - -CurrencyIcon.propTypes = { - currency: PropTypes.string.isRequired, - crypto: PropTypes.string.isRequired, - styles: PropTypes.object -} - -export default CurrencyIcon diff --git a/app/components/CurrencyIcon/index.js b/app/components/CurrencyIcon/index.js deleted file mode 100644 index da33382d..00000000 --- a/app/components/CurrencyIcon/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import CurrencyIcon from './CurrencyIcon' - -export default CurrencyIcon diff --git a/test/unit/components/CryptoIcon.spec.js b/test/unit/components/CryptoIcon.spec.js deleted file mode 100644 index 65d313c6..00000000 --- a/test/unit/components/CryptoIcon.spec.js +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react' -import { configure, shallow } from 'enzyme' -import Adapter from 'enzyme-adapter-react-16' -import CryptoIcon from 'components/CryptoIcon' -import SkinnyBitcoin from 'components/Icon/SkinnyBitcoin' -import Litecoin from 'components/Icon/Litecoin' - -configure({ adapter: new Adapter() }) - -const defaultProps = { - currency: 'bch', - styles: {} -} - -describe('component.CryptoIcon', () => { - describe('currency is "unknown"', () => { - const props = { ...defaultProps } - const el = shallow() - it('should show empty span', () => { - expect(el.html()).toEqual('') - }) - }) - - describe('currency is "btc"', () => { - const props = { ...defaultProps, currency: 'btc' } - const el = shallow() - it('should show btc symbol', () => { - expect(el.find(SkinnyBitcoin)).toHaveLength(1) - }) - }) - - describe('currency is "ltc"', () => { - const props = { ...defaultProps, currency: 'ltc' } - const el = shallow() - it('should show ltc symbol', () => { - expect(el.find(Litecoin)).toHaveLength(1) - }) - }) -}) diff --git a/test/unit/components/CurrencyIcon.spec.js b/test/unit/components/CurrencyIcon.spec.js deleted file mode 100644 index 7ecc8f33..00000000 --- a/test/unit/components/CurrencyIcon.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react' -import { configure, shallow } from 'enzyme' -import Adapter from 'enzyme-adapter-react-16' -import FaDollar from 'react-icons/lib/fa/dollar' -import CryptoIcon from 'components/CryptoIcon' -import CurrencyIcon from 'components/CurrencyIcon' - -configure({ adapter: new Adapter() }) - -const defaultProps = { - currency: '', - crypto: '', - styles: {} -} - -describe('component.CurrencyIcon', () => { - describe('currency is "usd"', () => { - const props = { ...defaultProps, currency: 'usd' } - const el = shallow() - it('should show usd symbol', () => { - expect(el.find(FaDollar)).toHaveLength(1) - }) - }) - - describe('currency is not "usd"', () => { - const props = { ...defaultProps, currency: 'btc' } - const el = shallow() - it('should show btc symbol', () => { - expect(el.find(CryptoIcon)).toHaveLength(1) - }) - }) -})