Sha256: 66f7d41c3ddd3878f0820d4d3efbcf9bc3ef525a63b2fd8e38b80317fcfcd772

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

import { testActionSnapshotWithFixtures } from '@theforeman/test';
import API from 'foremanReact/API';
import {
  fetchAccountsStatus,
  startAccountStatusPolling,
  stopAccountStatusPolling,
  restartProcess,
} from '../AccountListActions';
import {
  pollingProcessID,
  fetchAccountsStatusResponse,
} from '../AccountList.fixtures';
import { accountID, activeTab } from '../../Dashboard/Dashboard.fixtures';

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

const fixtures = {
  'should fetchAccountsStatus': () => fetchAccountsStatus(),
  'should startAccountStatusPolling': () =>
    startAccountStatusPolling(pollingProcessID),
  'should stopAccountStatusPolling': () =>
    stopAccountStatusPolling(pollingProcessID),
  'should restartProcess': () => restartProcess(accountID, activeTab),
  'should invoke toast notification upon failure': () => {
    API.post.mockImplementationOnce(() =>
      Promise.reject(new Error('test error'))
    );

    return restartProcess(accountID, activeTab);
  },
};

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman_rh_cloud-2.0.18.1 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-2.0.18 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-2.0.17 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-2.0.16 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-2.0.15 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-3.0.14 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-2.0.14 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-2.0.13.1 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-2.0.13 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js