From ab564ea5fdfda726a21b3f2d0d75099247a0ce7d Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Mon, 22 May 2017 21:26:27 +0800 Subject: [web] Add tests for js/components/FlowTable/FlowRow.js --- .../__tests__/components/FlowTable/FlowRowSpec.js | 21 ++++++++++ .../FlowTable/__snapshots__/FlowRowSpec.js.snap | 47 ++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 web/src/js/__tests__/components/FlowTable/FlowRowSpec.js create mode 100644 web/src/js/__tests__/components/FlowTable/__snapshots__/FlowRowSpec.js.snap (limited to 'web') 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(), + 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`] = ` + + + +
+ + + + http://address:22/path + + + GET + + + 200 + + + 14b + + + 415381h + + +`; -- cgit v1.2.3