Sha256: 01ec6356a2b621099e0b311c3aa833329e98daa3a5324613ddff3c48ec74d514

Contents?: true

Size: 1.27 KB

Versions: 12

Compression:

Stored size: 1.27 KB

Contents

import { testReducerSnapshotWithFixtures } from '@theforeman/test';

import reducer, { initialState } from '../NewTemplateSyncReducer';

import {
  importSettings,
  exportSettings,
} from '../__fixtures__/templateSyncSettings.fixtures';
import {
  SYNC_SETTINGS_REQUEST,
  SYNC_SETTINGS_SUCCESS,
  SYNC_SETTINGS_FAILURE,
} from '../../../consts';

const successPayload = {
  results: {
    import: importSettings,
    export: exportSettings,
  },
};

const fixtures = {
  'should return initial state': {
    state: initialState,
    action: {
      type: undefined,
      payload: {},
    },
  },
  'should start loading on setting values request': {
    state: initialState,
    action: {
      type: SYNC_SETTINGS_REQUEST,
    },
  },
  'should stop loading on setting values success': {
    state: initialState.set('loadingSettings', true),
    action: {
      type: SYNC_SETTINGS_SUCCESS,
      payload: successPayload,
    },
    'should stop loading on setting values error': {
      state: initialState.set('loadingSettings', true),
      action: {
        type: SYNC_SETTINGS_FAILURE,
        payload: {
          error: 'Failed to fetch setting values',
        },
      },
    },
  },
};

describe('NewTemplateSyncReducer', () =>
  testReducerSnapshotWithFixtures(reducer, fixtures));

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
foreman_templates-10.0.4 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-10.0.3 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-10.0.2 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-10.0.1 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-10.0.0 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.5.1 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.5.0 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.3.3 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.3.2 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.3.1 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.4.0 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.3.0 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js