Browse Source

test CryptoIcon and add specific src test to AnimatedCheckmark

renovate/lint-staged-8.x
Jonathan Zobro 7 years ago
parent
commit
3475b74a17
  1. 2
      test/components/AnimatedCheckmark.spec.js
  2. 36
      test/components/CryptoIcon.spec.js

2
test/components/AnimatedCheckmark.spec.js

@ -8,7 +8,7 @@ describe('component.AnimatedCheckmark', () => {
describe('default', () => {
it('should render default component', () => {
const el = shallow(<AnimatedCheckmark />)
expect(el.find(Isvg)).toHaveLength(1)
expect(el.find(Isvg).props().src).toContain('checkmark.svg')
})
})
})

36
test/components/CryptoIcon.spec.js

@ -0,0 +1,36 @@
import React from 'react'
import { shallow } from 'enzyme'
import { FaBitcoin } from 'react-icons/lib/fa'
import Isvg from 'react-inlinesvg'
import CryptoIcon from '../../app/components/CryptoIcon'
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(FaBitcoin)).toHaveLength(1)
})
})
describe('currency is "ltc"', () => {
const props = { ...defaultProps, currency: 'ltc' }
const el = shallow(<CryptoIcon {...props} />)
it('should show ltc symbol', () => {
expect(el.find(Isvg).props().src).toContain('litecoin.svg')
})
})
})
Loading…
Cancel
Save