Sha256: 3c6340562a91ad24ac2165a01ead04d2ca6ca286b0cfdfc145d25be99e965c5f

Contents?: true

Size: 762 Bytes

Versions: 3

Compression:

Stored size: 762 Bytes

Contents

import { testActionSnapshotWithFixtures } from '@theforeman/test';
import { API } from 'foremanReact/redux/API';
import { handleToggle } from '../AutoUploadSwitcherActions';
import {
  handleToggleResponse,
  currentAutoUploadEnabled,
} from '../AutoUploadSwitcher.fixtures';

jest.mock('foremanReact/redux/API');
API.post.mockImplementation(async () => handleToggleResponse);

const fixtures = {
  'should handleToggle': () => handleToggle(currentAutoUploadEnabled),
  'should handleToggle with error': () => {
    API.post.mockImplementationOnce(() =>
      Promise.reject(new Error('Network error!'))
    );

    return handleToggle(currentAutoUploadEnabled);
  },
};

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.17 webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js
foreman_rh_cloud-3.0.16 webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js
foreman_rh_cloud-3.0.15 webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js