Sha256: cd6ad82d599f3db4902797d73d7bd1eea4cf0101d3c92e61bb125952acabb12a

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

import { testActionSnapshotWithFixtures } from 'react-redux-test-utils';
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

10 entries across 10 versions & 1 rubygems

Version Path
foreman_rh_cloud-1.0.18 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-1.0.17 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-1.0.16 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-1.0.15 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-1.0.14 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-0.9.14 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-0.9.13.1 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-1.0.13.1 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-0.9.13 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
foreman_rh_cloud-1.0.13 webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js