github.com/thanos-io/thanos@v0.32.5/pkg/ui/react-app/src/thanos/pages/stores/StoreLabels.test.tsx (about)

     1  import React from 'react';
     2  import { shallow } from 'enzyme';
     3  import toJson from 'enzyme-to-json';
     4  import { ListGroup, ListGroupItem } from 'reactstrap';
     5  import StoreLabels from './StoreLabels';
     6  import { sampleAPIResponse } from './__testdata__/testdata';
     7  
     8  describe('storeLabels', () => {
     9    const { labelSets } = sampleAPIResponse.data.store[0];
    10    const storeLabels = shallow(<StoreLabels labelSets={labelSets} />);
    11  
    12    it('renders a listGroup', () => {
    13      const listGroup = storeLabels.find(ListGroup);
    14      expect(listGroup).toHaveLength(1);
    15    });
    16  
    17    it('renders a ListGroupItem for each labelSet', () => {
    18      const listGroupItems = storeLabels.find(ListGroupItem);
    19      expect(listGroupItems).toHaveLength(labelSets.length);
    20    });
    21  
    22    it('renders discovered labels', () => {
    23      expect(toJson(storeLabels)).toMatchSnapshot();
    24    });
    25  });