mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
[web] Add tests for js/components/common/DocsLink.jsx
This commit is contained in:
parent
ce15501c54
commit
9a7ac14654
17
web/src/js/__tests__/components/common/DocsLinkSpec.js
Normal file
17
web/src/js/__tests__/components/common/DocsLinkSpec.js
Normal file
@ -0,0 +1,17 @@
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import DocsLink from '../../../components/common/DocsLink'
|
||||
|
||||
describe('DocsLink Component', () => {
|
||||
it('should be able to be rendered with children nodes', () => {
|
||||
let docsLink = renderer.create(<DocsLink children="foo" resource="bar"></DocsLink>),
|
||||
tree = docsLink.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should be able to be rendered without children nodes', () => {
|
||||
let docsLink = renderer.create(<DocsLink resource="bar"></DocsLink>),
|
||||
tree = docsLink.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
@ -0,0 +1,21 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`DocsLink Component should be able to be rendered with children nodes 1`] = `
|
||||
<a
|
||||
href="http://docs.mitmproxy.org/en/stable/bar"
|
||||
target="_blank"
|
||||
>
|
||||
foo
|
||||
</a>
|
||||
`;
|
||||
|
||||
exports[`DocsLink Component should be able to be rendered without children nodes 1`] = `
|
||||
<a
|
||||
href="http://docs.mitmproxy.org/en/stable/bar"
|
||||
target="_blank"
|
||||
>
|
||||
<i
|
||||
className="fa fa-question-circle"
|
||||
/>
|
||||
</a>
|
||||
`;
|
@ -1,3 +1,4 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
|
||||
DocsLink.propTypes = {
|
||||
|
Loading…
Reference in New Issue
Block a user