App.test.tsx 825 字节
Newer Older
1 2 3 4 5 6 7 8 9
import * as React from 'react';
import { shallow } from 'enzyme';
import App from './App';
import Navigation from './Navbar';
import { Container } from 'reactstrap';
import { Router } from '@reach/router';
import { Alerts, Config, Flags, Rules, Services, Status, Targets, PanelList } from './pages';

describe('App', () => {
10
  const app = shallow(<App pathPrefix="/path/prefix" />);
11 12 13 14 15

  it('navigates', () => {
    expect(app.find(Navigation)).toHaveLength(1);
  });
  it('routes', () => {
16 17 18 19 20
    [Alerts, Config, Flags, Rules, Services, Status, Targets, PanelList].forEach(component => {
      const c = app.find(component);
      expect(c).toHaveLength(1);
      expect(c.prop('pathPrefix')).toBe('/path/prefix');
    });
21 22 23 24
    expect(app.find(Router)).toHaveLength(1);
    expect(app.find(Container)).toHaveLength(1);
  });
});