From b77c0ea7bbfb72225f61b304203dbafebe287c88 Mon Sep 17 00:00:00 2001 From: Ayush Sharma Date: Wed, 29 Nov 2017 17:20:17 +0530 Subject: [PATCH] webui: component test case --- test/webui/components/readme.spec.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/webui/components/readme.spec.js diff --git a/test/webui/components/readme.spec.js b/test/webui/components/readme.spec.js new file mode 100644 index 000000000..d1f6ed7d8 --- /dev/null +++ b/test/webui/components/readme.spec.js @@ -0,0 +1,26 @@ +/** + * Readme component + */ + +import React from 'react'; +import { shallow } from 'enzyme'; +import Readme from '../../../src/webui/src/components/Readme'; + +console.error = jest.fn(); + +describe(' component', () => { + it('should give error for the required fields', () => { + shallow(); + expect(console.error).toBeCalled(); + }); + + it('should dangerously set html', () => { + const props = { + readMe: '

This is a test string

' + }; + const wrapper = shallow(); + expect(wrapper.html()).toEqual( + '

This is a test string

' + ); + }); +});