2017-11-29 12:50:17 +01:00
|
|
|
/**
|
|
|
|
* Readme component
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
2018-06-17 13:34:59 +02:00
|
|
|
import Readme from '../../../../src/webui/src/components/Readme/index';
|
2017-11-29 12:50:17 +01:00
|
|
|
|
|
|
|
console.error = jest.fn();
|
|
|
|
|
|
|
|
describe('<Readme /> component', () => {
|
|
|
|
it('should give error for the required fields', () => {
|
|
|
|
shallow(<Readme />);
|
|
|
|
expect(console.error).toBeCalled();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should dangerously set html', () => {
|
|
|
|
const props = {
|
|
|
|
readMe: '<h1>This is a test string</h1>'
|
|
|
|
};
|
|
|
|
const wrapper = shallow(<Readme {...props} />);
|
|
|
|
expect(wrapper.html()).toEqual(
|
|
|
|
'<div class="markdown-body"><h1>This is a test string</h1></div>'
|
|
|
|
);
|
2017-12-02 15:01:06 +01:00
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
2017-11-29 12:50:17 +01:00
|
|
|
});
|
|
|
|
});
|