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';
|
2021-08-30 05:05:49 -07:00
|
|
|
import { Route } from 'react-router-dom';
|
2021-06-15 13:37:16 -07:00
|
|
|
import {
|
2021-11-30 02:21:07 -08:00
|
|
|
AgentPage,
|
2021-06-15 13:37:16 -07:00
|
|
|
AlertsPage,
|
|
|
|
ConfigPage,
|
|
|
|
FlagsPage,
|
|
|
|
RulesPage,
|
|
|
|
ServiceDiscoveryPage,
|
|
|
|
StatusPage,
|
|
|
|
TargetsPage,
|
|
|
|
TSDBStatusPage,
|
|
|
|
PanelListPage,
|
|
|
|
} from './pages';
|
2019-10-28 10:09:48 -07:00
|
|
|
|
|
|
|
describe('App', () => {
|
2022-03-05 11:45:55 -08:00
|
|
|
const app = shallow(<App consolesLink={null} agentMode={false} />);
|
2019-10-28 10:09:48 -07:00
|
|
|
|
|
|
|
it('navigates', () => {
|
|
|
|
expect(app.find(Navigation)).toHaveLength(1);
|
|
|
|
});
|
|
|
|
it('routes', () => {
|
2021-06-15 13:37:16 -07:00
|
|
|
[
|
2021-11-30 02:21:07 -08:00
|
|
|
AgentPage,
|
2021-06-15 13:37:16 -07:00
|
|
|
AlertsPage,
|
|
|
|
ConfigPage,
|
|
|
|
FlagsPage,
|
|
|
|
RulesPage,
|
|
|
|
ServiceDiscoveryPage,
|
|
|
|
StatusPage,
|
|
|
|
TargetsPage,
|
|
|
|
TSDBStatusPage,
|
|
|
|
PanelListPage,
|
2021-09-03 08:41:20 -07:00
|
|
|
].forEach((component) => {
|
2019-11-04 00:17:50 -08:00
|
|
|
const c = app.find(component);
|
|
|
|
expect(c).toHaveLength(1);
|
|
|
|
});
|
2021-11-30 02:21:07 -08:00
|
|
|
expect(app.find(Route)).toHaveLength(10);
|
2019-10-28 10:09:48 -07:00
|
|
|
expect(app.find(Container)).toHaveLength(1);
|
|
|
|
});
|
|
|
|
});
|