Sha256: 9da2bc7f56f7a38fcf5ab10dcd0caa9cabb91f478d0a4d74a6d2e81fd6777c58

Contents?: true

Size: 1.41 KB

Versions: 81

Compression:

Stored size: 1.41 KB

Contents

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

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

const runWithGetState = (state, action, params) => dispatch => {
  const getState = () => rhCloudStateWrapper({ 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', () => {
  const { open } = window;

  beforeAll(() => {
    delete window.open;
    window.open = jest.fn();
  });

  afterAll(() => {
    window.open = open;
  });

  return testActionSnapshotWithFixtures(fixtures);
});

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
foreman_rh_cloud-9.0.59 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-11.0.2 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-11.0.1 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-11.0.0 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-9.0.58 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-10.0.2 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-9.0.57 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-10.0.1 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-9.0.56 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-9.0.55 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-9.0.54 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-9.0.53 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-9.0.52 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-8.0.52 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-9.0.51 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-8.0.51 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-7.0.48 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-7.0.47 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-8.0.50 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
foreman_rh_cloud-8.0.49 webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js