mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 09:37:37 +00:00
[web] Add tests for js/components/FlowTable/FlowRow.js
This commit is contained in:
parent
2222f0b65a
commit
ab564ea5fd
21
web/src/js/__tests__/components/FlowTable/FlowRowSpec.js
Normal file
21
web/src/js/__tests__/components/FlowTable/FlowRowSpec.js
Normal file
@ -0,0 +1,21 @@
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import FlowRow from '../../../components/FlowTable/FlowRow'
|
||||
import { TFlow } from '../../ducks/tutils'
|
||||
|
||||
describe('FlowRow Component', () => {
|
||||
let tFlow = new TFlow(),
|
||||
selectFn = jest.fn(),
|
||||
flowRow = renderer.create(<FlowRow flow={tFlow} onSelect={selectFn}/>),
|
||||
tree = flowRow.toJSON()
|
||||
|
||||
it('should render correctly', () => {
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should handle click', () => {
|
||||
tree.props.onClick()
|
||||
expect(selectFn).toBeCalledWith(tFlow.id)
|
||||
})
|
||||
|
||||
})
|
@ -0,0 +1,47 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`FlowRow Component should render correctly 1`] = `
|
||||
<tr
|
||||
className="has-request has-response"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<td
|
||||
className="col-tls col-tls-http"
|
||||
/>
|
||||
<td
|
||||
className="col-icon"
|
||||
>
|
||||
<div
|
||||
className="resource-icon resource-icon-plain"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
className="col-path"
|
||||
>
|
||||
<i
|
||||
className="fa fa-fw fa-exclamation pull-right"
|
||||
/>
|
||||
http://address:22/path
|
||||
</td>
|
||||
<td
|
||||
className="col-method"
|
||||
>
|
||||
GET
|
||||
</td>
|
||||
<td
|
||||
className="col-status"
|
||||
>
|
||||
200
|
||||
</td>
|
||||
<td
|
||||
className="col-size"
|
||||
>
|
||||
14b
|
||||
</td>
|
||||
<td
|
||||
className="col-time"
|
||||
>
|
||||
415381h
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
Loading…
Reference in New Issue
Block a user