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