@navinc/base-react-components
Version:
Nav's Pattern Library
32 lines (24 loc) • 772 B
JavaScript
import React from 'react'
import { shallow } from 'enzyme'
import { Err, FieldWrapper } from '../../form-elements/shared.js'
import { CurrencyInputField } from './'
describe('Base Components: CurrencyInput', () => {
let shallowWrapper
beforeEach(() => {
shallowWrapper = shallow(<CurrencyInputField />)
})
describe('render', () => {
it('renders the outer div', () => {
expect(shallowWrapper.is(FieldWrapper)).toBe(true)
})
it('renders errors if there are any', () => {
shallowWrapper.setProps({
errors: ['yoyo'],
})
expect(shallowWrapper.find(Err).exists()).toBe(true)
})
it('doesnt render errors if there arent any', () => {
expect(shallowWrapper.find(Err).exists()).toBe(false)
})
})
})