Commit f7fe4d48 by Lukas Siatka Committed by Lukas Siatka

Explore: adds MetaInfoText tests

parent 61b5471e
import React from 'react';
import { shallow, render } from 'enzyme';
import { MetaInfoText, MetaItemProps } from './MetaInfoText';
describe('MetaInfoText', () => {
it('should render component', () => {
const items: MetaItemProps[] = [
{ label: 'label', value: 'value' },
{ label: 'label2', value: 'value2' },
];
const wrapper = shallow(<MetaInfoText metaItems={items} />);
expect(wrapper).toMatchSnapshot();
});
it('should render items', () => {
const items: MetaItemProps[] = [
{ label: 'label', value: 'value' },
{ label: 'label2', value: 'value2' },
];
const wrapper = render(<MetaInfoText metaItems={items} />);
expect(wrapper.find('label')).toBeTruthy();
expect(wrapper.find('value')).toBeTruthy();
expect(wrapper.find('label2')).toBeTruthy();
expect(wrapper.find('value2')).toBeTruthy();
});
it('should render no items when the array is empty', () => {
const items: MetaItemProps[] = [];
const wrapper = shallow(<MetaInfoText metaItems={items} />);
expect(wrapper.find('div').exists()).toBeTruthy();
expect(wrapper.find('div').children()).toHaveLength(0);
});
});
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`MetaInfoText should render component 1`] = `
<div
className="css-mi7ebz"
>
<Component
key="0-label"
label="label"
value="value"
/>
<Component
key="1-label2"
label="label2"
value="value2"
/>
</div>
`;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment