Sha256: 7029a52bfdb1eced68e9d826ee379736b39084f37c054a5d94be6991ad04fa31

Contents?: true

Size: 1.15 KB

Versions: 21

Compression:

Stored size: 1.15 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';

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

const runWithGetState = (state, action, params) => dispatch => {
  const getState = () => ({
    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

21 entries across 21 versions & 2 rubygems

Version Path
foreman_rh_cloud-0.9.6 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-1.0.6 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-0.9.5 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-1.0.5 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-0.9.4.1 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-1.0.4.1 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-1.0.4 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-0.9.4 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-1.0.3 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-0.9.2 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-1.0.2 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-0.9.1 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-1.0.1 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-0.9.0 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-1.0.0 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-1.0.0.beta7 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-1.0.0.beta6 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-1.0.0.beta5 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-1.0.0.beta4 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_inventory_upload-1.0.0.beta3 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js