Sha256: 22edc76719bac7fd00126199c81d21c7cf8ca72f39dac77f1603e136bcdcf447

Contents?: true

Size: 792 Bytes

Versions: 3

Compression:

Stored size: 792 Bytes

Contents

import { testActionSnapshotWithFixtures } from '@theforeman/test';
import { API } from 'foremanReact/redux/API';
import { handleToggle } from '../HostObfuscationSwitcherActions';
import {
  handleToggleResponse,
  currentHostObfuscationEnabled,
} from '../HostObfuscationSwitcher.fixtures';

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

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

    return handleToggle(currentHostObfuscationEnabled);
  },
};

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.17 webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js
foreman_rh_cloud-3.0.16 webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js
foreman_rh_cloud-3.0.15 webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js