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

     1  import * as React from 'react';
     2  import { shallow } from 'enzyme';
     3  import App from './App';
     4  import Navigation from './thanos/Navbar';
     5  import { Container } from 'reactstrap';
     6  import { Router } from '@reach/router';
     7  import { Alerts, Config, Flags, Rules, ServiceDiscovery, Status, Targets, TSDBStatus, PanelList } from './pages';
     8  
     9  describe('App', () => {
    10    const app = shallow(<App pathPrefix="/path/prefix" thanosComponent="query" />);
    11  
    12    it('navigates', () => {
    13      expect(app.find(Navigation)).toHaveLength(1);
    14    });
    15    it('routes', () => {
    16      [Alerts, Config, Flags, Rules, ServiceDiscovery, Status, Targets, TSDBStatus, PanelList].forEach((component) => {
    17        const c = app.find(component);
    18        expect(c).toHaveLength(1);
    19        expect(c.prop('pathPrefix')).toBe('/path/prefix');
    20      });
    21      expect(app.find(Router)).toHaveLength(1);
    22      expect(app.find(Container)).toHaveLength(1);
    23    });
    24  });