test(tag): add testcase

This commit is contained in:
unix
2020-04-19 18:11:20 +08:00
parent 1d0e685d27
commit 1ad320bafa
2 changed files with 1737 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
import React from 'react'
import { mount, render } from 'enzyme'
import { Tag } from 'components'
describe('Tag', () => {
it('should render correctly', () => {
const wrapper = mount(<Tag>tag</Tag>)
expect(() => wrapper.unmount()).not.toThrow()
})
it('should work with types', () => {
const wrapper = render(
<div>
<Tag type="success">success</Tag>
<Tag type="secondary">secondary</Tag>
<Tag type="error">error</Tag>
<Tag type="dark">dark</Tag>
</div>
)
expect(wrapper).toMatchSnapshot()
})
it('should work with invert', () => {
const wrapper = render(<Tag type="success" invert>success</Tag>)
expect(wrapper).toMatchSnapshot()
})
it('should work when child is null', () => {
const wrapper = mount(<Tag />)
expect(() => wrapper.unmount()).not.toThrow()
})
})