diff options
-rw-r--r-- | web/src/js/__tests__/components/FlowTable/FlowRowSpec.js | 21 | ||||
-rw-r--r-- | web/src/js/__tests__/components/FlowTable/__snapshots__/FlowRowSpec.js.snap | 47 |
2 files changed, 68 insertions, 0 deletions
diff --git a/web/src/js/__tests__/components/FlowTable/FlowRowSpec.js b/web/src/js/__tests__/components/FlowTable/FlowRowSpec.js new file mode 100644 index 00000000..7dfc1dcd --- /dev/null +++ b/web/src/js/__tests__/components/FlowTable/FlowRowSpec.js @@ -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) + }) + +}) diff --git a/web/src/js/__tests__/components/FlowTable/__snapshots__/FlowRowSpec.js.snap b/web/src/js/__tests__/components/FlowTable/__snapshots__/FlowRowSpec.js.snap new file mode 100644 index 00000000..b065b746 --- /dev/null +++ b/web/src/js/__tests__/components/FlowTable/__snapshots__/FlowRowSpec.js.snap @@ -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> +`; |