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