2019-10-28 10:09:48 -07:00
|
|
|
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';
|
2020-02-03 06:14:25 -08:00
|
|
|
import { Alerts, Config, Flags, Rules, ServiceDiscovery, Status, Targets, TSDBStatus, PanelList } from './pages';
|
2019-10-28 10:09:48 -07:00
|
|
|
|
|
|
|
describe('App', () => {
|
2019-11-04 00:17:50 -08:00
|
|
|
const app = shallow(<App pathPrefix="/path/prefix" />);
|
2019-10-28 10:09:48 -07:00
|
|
|
|
|
|
|
it('navigates', () => {
|
|
|
|
expect(app.find(Navigation)).toHaveLength(1);
|
|
|
|
});
|
|
|
|
it('routes', () => {
|
2020-02-03 06:14:25 -08:00
|
|
|
[Alerts, Config, Flags, Rules, ServiceDiscovery, Status, Targets, TSDBStatus, PanelList].forEach(component => {
|
2019-11-04 00:17:50 -08:00
|
|
|
const c = app.find(component);
|
|
|
|
expect(c).toHaveLength(1);
|
|
|
|
expect(c.prop('pathPrefix')).toBe('/path/prefix');
|
|
|
|
});
|
2019-10-28 10:09:48 -07:00
|
|
|
expect(app.find(Router)).toHaveLength(1);
|
|
|
|
expect(app.find(Container)).toHaveLength(1);
|
|
|
|
});
|
|
|
|
});
|