grafana/public/app/features/admin/ServerStats.test.tsx
Alex Khomenko a15e33e693
Admin: remove Redux from ServerStats (#38581)
* Admin: remove Redux from ServerStats

* Admin: Fix import
2021-08-27 11:09:17 +03:00

41 lines
1.1 KiB
TypeScript

import React from 'react';
import { render, screen } from '@testing-library/react';
import { ServerStats } from './ServerStats';
import { ServerStat } from './state/apis';
const stats: ServerStat = {
activeAdmins: 1,
activeEditors: 0,
activeSessions: 1,
activeUsers: 1,
activeViewers: 0,
admins: 1,
alerts: 5,
dashboards: 1599,
datasources: 54,
editors: 2,
orgs: 1,
playlists: 1,
snapshots: 1,
stars: 3,
tags: 42,
users: 5,
viewers: 2,
};
jest.mock('./state/apis', () => ({
getServerStats: async () => stats,
}));
describe('ServerStats', () => {
it('Should render page with stats', async () => {
render(<ServerStats />);
expect(await screen.findByRole('heading', { name: /instance statistics/i })).toBeInTheDocument();
expect(screen.getByText('Dashboards (starred)')).toBeInTheDocument();
expect(screen.getByText('Tags')).toBeInTheDocument();
expect(screen.getByText('Playlists')).toBeInTheDocument();
expect(screen.getByText('Snapshots')).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'Manage dashboards' })).toBeInTheDocument();
});
});