mirror of
https://github.com/zhigang1992/react.git
synced 2026-03-26 22:42:51 +08:00
test(description): add testcase
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Description should render correctly 1`] = `ReactWrapper {}`;
|
||||
27
components/description/__tests__/index.test.tsx
Normal file
27
components/description/__tests__/index.test.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import React from 'react'
|
||||
import { mount } from 'enzyme'
|
||||
import { Description } from 'components'
|
||||
|
||||
describe('Description', () => {
|
||||
it('should render correctly', () => {
|
||||
const wrapper = mount(<Description title="title" />)
|
||||
expect(wrapper).toMatchSnapshot()
|
||||
expect(() => wrapper.unmount()).not.toThrow()
|
||||
})
|
||||
|
||||
it('should render react-node on title', () => {
|
||||
let wrapper = mount(<Description title={<p>p</p>} />)
|
||||
expect(wrapper.find('p').length).not.toBe(0)
|
||||
|
||||
wrapper = mount(<Description title={<h1>p</h1>} />)
|
||||
expect(wrapper.find('h1').length).not.toBe(0)
|
||||
})
|
||||
|
||||
it('should render react-node on content', () => {
|
||||
let wrapper = mount(<Description content={<p>p</p>} />)
|
||||
expect(wrapper.find('p').length).not.toBe(0)
|
||||
|
||||
wrapper = mount(<Description content={<h1>p</h1>} />)
|
||||
expect(wrapper.find('h1').length).not.toBe(0)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user