ServerStats.jest.tsx 777 B

123456789101112131415161718192021222324252627282930
  1. import React from 'react';
  2. import renderer from 'react-test-renderer';
  3. import { ServerStats } from './ServerStats';
  4. import { RootStore } from 'app/stores/RootStore/RootStore';
  5. import { backendSrv, createNavTree } from 'test/mocks/common';
  6. describe('ServerStats', () => {
  7. it('Should render table with stats', done => {
  8. backendSrv.get.mockReturnValue(
  9. Promise.resolve({
  10. dashboards: 10,
  11. })
  12. );
  13. const store = RootStore.create(
  14. {},
  15. {
  16. backendSrv: backendSrv,
  17. navTree: createNavTree('cfg', 'admin', 'server-stats'),
  18. }
  19. );
  20. const page = renderer.create(<ServerStats backendSrv={backendSrv} {...store} />);
  21. setTimeout(() => {
  22. expect(page.toJSON()).toMatchSnapshot();
  23. done();
  24. });
  25. });
  26. });