prometheus/web/ui/react-app/src/pages/Status.test.tsx

54 lines
1.6 KiB
TypeScript
Raw Normal View History

2019-11-02 08:53:32 -07:00
import * as React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
2019-11-12 05:35:47 -08:00
import { StatusContent } from './Status';
2019-11-02 08:53:32 -07:00
describe('Status', () => {
2019-11-12 05:35:47 -08:00
it('should not fail with undefined data', () => {
const wrapper = shallow(<StatusContent data={[]} />);
expect(wrapper).toHaveLength(1);
2019-11-02 08:53:32 -07:00
});
describe('Snapshot testing', () => {
2019-11-12 05:35:47 -08:00
const response: any = [
2019-11-02 08:53:32 -07:00
{
startTime: '2019-10-30T22:03:23.247913868+02:00',
CWD: '/home/boyskila/Desktop/prometheus',
reloadConfigSuccess: true,
lastConfigTime: '2019-10-30T22:03:23+02:00',
chunkCount: 1383,
timeSeriesCount: 461,
corruptionCount: 0,
goroutineCount: 37,
GOMAXPROCS: 4,
GOGC: '',
GODEBUG: '',
storageRetention: '15d',
},
{
version: '',
revision: '',
branch: '',
buildUser: '',
buildDate: '',
goVersion: 'go1.13.3',
},
{
activeAlertmanagers: [
{ url: 'https://1.2.3.4:9093/api/v1/alerts' },
{ url: 'https://1.2.3.5:9093/api/v1/alerts' },
{ url: 'https://1.2.3.6:9093/api/v1/alerts' },
{ url: 'https://1.2.3.7:9093/api/v1/alerts' },
{ url: 'https://1.2.3.8:9093/api/v1/alerts' },
{ url: 'https://1.2.3.9:9093/api/v1/alerts' },
],
droppedAlertmanagers: [],
},
];
it('should match table snapshot', () => {
2019-11-12 05:35:47 -08:00
const wrapper = shallow(<StatusContent data={response} />);
2019-11-02 08:53:32 -07:00
expect(toJson(wrapper)).toMatchSnapshot();
jest.restoreAllMocks();
});
});
});