Sha256: 60f641920953a4fc6bc2d6dac0c2803e453ce88c24d2dc6ce445b0257c45fc2f

Contents?: true

Size: 826 Bytes

Versions: 9

Compression:

Stored size: 826 Bytes

Contents

import API from 'foremanReact/API';

import { testActionSnapshotWithFixtures } from '@theforeman/test';
import { getStatisticsMeta } from '../StatisticsPageActions';
import { statisticsProps } from '../StatisticsPage.fixtures';

jest.mock('foremanReact/API');

const runStatisticsAction = (callback, props, serverMock) => {
  API.get.mockImplementation(serverMock);

  return callback(props);
};

const fixtures = {
  'should fetch statisticsMeta': () =>
    runStatisticsAction(getStatisticsMeta, {}, async () => ({
      data: { charts: statisticsProps.statisticsMeta },
    })),
  'should fetch statisticsMeta and fail': () =>
    runStatisticsAction(getStatisticsMeta, {}, async () => {
      throw new Error('some-error');
    }),
};

describe('StatisticsPage actions', () =>
  testActionSnapshotWithFixtures(fixtures));

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman_statistics-2.1.0 webpack/src/Router/StatisticsPage/__tests__/StatisticsPageActions.test.js
foreman_statistics-2.0.1 webpack/src/Router/StatisticsPage/__tests__/StatisticsPageActions.test.js
foreman_statistics-2.0.0 webpack/src/Router/StatisticsPage/__tests__/StatisticsPageActions.test.js
foreman_statistics-1.2.0 webpack/src/Router/StatisticsPage/__tests__/StatisticsPageActions.test.js
foreman_statistics-1.1.1 webpack/src/Router/StatisticsPage/__tests__/StatisticsPageActions.test.js
foreman_statistics-1.1.0 webpack/src/Router/StatisticsPage/__tests__/StatisticsPageActions.test.js
foreman_statistics-1.0.0 webpack/src/Router/StatisticsPage/__tests__/StatisticsPageActions.test.js
foreman_statistics-0.1.3 webpack/src/Router/StatisticsPage/__tests__/StatisticsPageActions.test.js
foreman_statistics-0.1.2 webpack/src/Router/StatisticsPage/__tests__/StatisticsPageActions.test.js