Sha256: 79a3869b0a7d5a56697d3f7437f0c7b6b1ef78e251166040da1cc6d167768dbd

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

import { testActionSnapshotWithFixtures } from 'react-redux-test-utils';
import API from 'foremanReact/API';
import {
  startPolling,
  stopPolling,
  fetchLogs,
  setActiveTab,
  downloadReports,
  toggleFullScreen,
} from '../DashboardActions';
import {
  pollingProcessID,
  serverMock,
  activeTab,
  accountID,
} from '../Dashboard.fixtures';
import { inventoryStateWrapper } from '../../../../ForemanRhCloudTestHelpers';

jest.mock('foremanReact/API');
API.get.mockImplementation(() => serverMock);

const runWithGetState = (state, action, params) => dispatch => {
  const getState = () => inventoryStateWrapper({ dashboard: state });
  action(params)(dispatch, getState);
};

const fixtures = {
  'should startPolling': () => startPolling(accountID, pollingProcessID),
  'should fetchLogs': () =>
    runWithGetState({ activeTab: 'uploads' }, fetchLogs, accountID),
  'should stopPolling': () => stopPolling(accountID, pollingProcessID),
  'should setActiveTab': () => setActiveTab(accountID, activeTab),
  'should downloadReports': () => downloadReports(accountID),
  'should toggleFullScreen': () =>
    runWithGetState({ activeTab: 'reports' }, toggleFullScreen, accountID),
};

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_rh_cloud-0.9.7 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-1.0.7 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js