Sha256: 146a99c15571b18631acc691c70fe8d2350f92516a860c419feb07c042f5eb24

Contents?: true

Size: 1.27 KB

Versions: 12

Compression:

Stored size: 1.27 KB

Contents

import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';

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-9.2.0 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.1.0 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.0.2 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.0.1 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-9.0.0 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-7.0.7 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-8.0.0 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-7.0.6 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-7.0.5 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-7.0.4 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-7.0.3 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js
foreman_templates-7.0.2 webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js