From 298ac8391e86999c00804b2ed891ab8b7d4a6e39 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Mon, 5 Jun 2017 10:19:09 +0800 Subject: [PATCH] [web] Add tests for js/components/ContentView/MetaViews.jsx --- .../components/ContentView/MetaViewsSpec.js | 37 +++++++++++ .../__snapshots__/MetaViewsSpec.js.snap | 66 +++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 web/src/js/__tests__/components/ContentView/MetaViewsSpec.js create mode 100644 web/src/js/__tests__/components/ContentView/__snapshots__/MetaViewsSpec.js.snap diff --git a/web/src/js/__tests__/components/ContentView/MetaViewsSpec.js b/web/src/js/__tests__/components/ContentView/MetaViewsSpec.js new file mode 100644 index 000000000..8867ccbee --- /dev/null +++ b/web/src/js/__tests__/components/ContentView/MetaViewsSpec.js @@ -0,0 +1,37 @@ +import React from 'react' +import renderer from 'react-test-renderer' +import { ContentEmpty, ContentMissing, ContentTooLarge } from '../../../components/ContentView/MetaViews' +import { TFlow } from '../../ducks/tutils' + +let tflow = new TFlow() + +describe('ContentEmpty Components', () => { + it('should render correctly', () => { + let contentEmpty = renderer.create(), + tree = contentEmpty.toJSON() + expect(tree).toMatchSnapshot() + }) +}) + +describe('ContentMissing Components', () => { + it('should render correctly', () => { + let contentMissing = renderer.create(), + tree = contentMissing.toJSON() + expect(tree).toMatchSnapshot() + }) +}) + +describe('ContentTooLarge Components', () => { + it('should render correctly', () => { + let clickFn = jest.fn(), + uploadContentFn = jest.fn(), + contentTooLarge = renderer.create(), + tree = contentTooLarge.toJSON() + expect(tree).toMatchSnapshot() + }) +}) diff --git a/web/src/js/__tests__/components/ContentView/__snapshots__/MetaViewsSpec.js.snap b/web/src/js/__tests__/components/ContentView/__snapshots__/MetaViewsSpec.js.snap new file mode 100644 index 000000000..18ec5bba9 --- /dev/null +++ b/web/src/js/__tests__/components/ContentView/__snapshots__/MetaViewsSpec.js.snap @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ContentEmpty Components should render correctly 1`] = ` +
+ No + response + content. +
+`; + +exports[`ContentMissing Components should render correctly 1`] = ` +
+ Response + content missing. +
+`; + +exports[`ContentTooLarge Components should render correctly 1`] = ` +
+
+ + 7b + content size. +
+
+ + + + +   + + + +
+
+`;