ServerStats.jest.tsx 633 B

123456789101112131415161718192021222324
  1. import React from 'react';
  2. import renderer from 'react-test-renderer';
  3. import { ServerStats } from './ServerStats';
  4. import { RootStore } from 'app/stores/RootStore';
  5. describe('ServerStats', () => {
  6. it('Should render table with stats', done => {
  7. let backendSrvMock = {
  8. get: jest.fn().mockReturnValue(
  9. Promise.resolve({
  10. dashboards: 10,
  11. })
  12. ),
  13. };
  14. const store = RootStore.create({}, { backendSrv: backendSrvMock });
  15. const page = renderer.create(<ServerStats store={store} />);
  16. setTimeout(() => {
  17. expect(page.toJSON()).toMatchSnapshot();
  18. done();
  19. });
  20. });
  21. });