Tom Kirkpatrick
6 years ago
6 changed files with 0 additions and 120 deletions
@ -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 <SkinnyBitcoin style={styles} /> |
|
||||
case 'ltc': |
|
||||
return <Litecoin style={styles} /> |
|
||||
default: |
|
||||
return <span /> |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
CryptoIcon.propTypes = { |
|
||||
currency: PropTypes.string.isRequired, |
|
||||
styles: PropTypes.object |
|
||||
} |
|
||||
|
|
||||
export default CryptoIcon |
|
@ -1,3 +0,0 @@ |
|||||
import CryptoIcon from './CryptoIcon' |
|
||||
|
|
||||
export default CryptoIcon |
|
@ -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' ? ( |
|
||||
<FaDollar style={styles} /> |
|
||||
) : ( |
|
||||
<CryptoIcon styles={styles} currency={crypto} /> |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
CurrencyIcon.propTypes = { |
|
||||
currency: PropTypes.string.isRequired, |
|
||||
crypto: PropTypes.string.isRequired, |
|
||||
styles: PropTypes.object |
|
||||
} |
|
||||
|
|
||||
export default CurrencyIcon |
|
@ -1,3 +0,0 @@ |
|||||
import CurrencyIcon from './CurrencyIcon' |
|
||||
|
|
||||
export default CurrencyIcon |
|
@ -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(<CryptoIcon {...props} />) |
|
||||
it('should show empty span', () => { |
|
||||
expect(el.html()).toEqual('<span></span>') |
|
||||
}) |
|
||||
}) |
|
||||
|
|
||||
describe('currency is "btc"', () => { |
|
||||
const props = { ...defaultProps, currency: 'btc' } |
|
||||
const el = shallow(<CryptoIcon {...props} />) |
|
||||
it('should show btc symbol', () => { |
|
||||
expect(el.find(SkinnyBitcoin)).toHaveLength(1) |
|
||||
}) |
|
||||
}) |
|
||||
|
|
||||
describe('currency is "ltc"', () => { |
|
||||
const props = { ...defaultProps, currency: 'ltc' } |
|
||||
const el = shallow(<CryptoIcon {...props} />) |
|
||||
it('should show ltc symbol', () => { |
|
||||
expect(el.find(Litecoin)).toHaveLength(1) |
|
||||
}) |
|
||||
}) |
|
||||
}) |
|
@ -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(<CurrencyIcon {...props} />) |
|
||||
it('should show usd symbol', () => { |
|
||||
expect(el.find(FaDollar)).toHaveLength(1) |
|
||||
}) |
|
||||
}) |
|
||||
|
|
||||
describe('currency is not "usd"', () => { |
|
||||
const props = { ...defaultProps, currency: 'btc' } |
|
||||
const el = shallow(<CurrencyIcon {...props} />) |
|
||||
it('should show btc symbol', () => { |
|
||||
expect(el.find(CryptoIcon)).toHaveLength(1) |
|
||||
}) |
|
||||
}) |
|
||||
}) |
|
Loading…
Reference in new issue