1import React from 'react';
2import { shallow } from 'enzyme';
3
4import { UnThemedLogLabels as LogLabels } from './LogLabels';
5import { getTheme } from '../../themes';
6
7describe('<LogLabels />', () => {
8  it('renders notice when no labels are found', () => {
9    const wrapper = shallow(<LogLabels labels={{}} theme={getTheme()} />);
10    expect(wrapper.text()).toContain('no unique labels');
11  });
12  it('renders labels', () => {
13    const wrapper = shallow(<LogLabels labels={{ foo: 'bar', baz: '42' }} theme={getTheme()} />);
14    expect(wrapper.text()).toContain('bar');
15    expect(wrapper.text()).toContain('42');
16  });
17  it('excludes labels with certain names or labels starting with underscore', () => {
18    const wrapper = shallow(<LogLabels labels={{ foo: 'bar', level: '42', _private: '13' }} theme={getTheme()} />);
19    expect(wrapper.text()).toContain('bar');
20    expect(wrapper.text()).not.toContain('42');
21    expect(wrapper.text()).not.toContain('13');
22  });
23  it('excludes labels with empty string values', () => {
24    const wrapper = shallow(<LogLabels labels={{ foo: 'bar', baz: '' }} theme={getTheme()} />);
25    expect(wrapper.text()).toContain('bar');
26    expect(wrapper.html()).not.toContain('baz');
27  });
28});
29