Sha256: 34b425dfa7ef8d06bf70d224bbdc1a3536f0cf21d749ef440fa67c94a560b5aa

Contents?: true

Size: 1.85 KB

Versions: 33

Compression:

Stored size: 1.85 KB

Contents

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

import reducer, { initialState } from '../AnsibleRolesSwitcherReducer';
import { ansibleRolesLong } from '../__fixtures__/ansibleRolesData.fixtures';

import {
  successPayload,
  successState,
  errorPayload,
} from '../__fixtures__/ansibleRolesSwitcherReducer.fixtures';

import {
  ANSIBLE_ROLES_REQUEST,
  ANSIBLE_ROLES_SUCCESS,
  ANSIBLE_ROLES_FAILURE,
  ANSIBLE_ROLES_ADD,
  ANSIBLE_ROLES_REMOVE,
  ANSIBLE_ROLES_ASSIGNED_PAGE_CHANGE,
} from '../AnsibleRolesSwitcherConstants';

const fixtures = {
  'should return initial state': {
    state: initialState,
    action: {
      type: undefined,
      payload: {},
    },
  },
  'should start loading on Ansible roles request': {
    state: initialState,
    action: {
      type: ANSIBLE_ROLES_REQUEST,
    },
  },
  'should stop loading on Ansible roles success': {
    state: initialState.set('loading', true),
    action: {
      type: ANSIBLE_ROLES_SUCCESS,
      payload: successPayload,
    },
  },
  'should stop loading on Ansible roles error': {
    state: initialState.set('loading', true),
    action: {
      type: ANSIBLE_ROLES_FAILURE,
      payload: { error: errorPayload },
    },
  },
  'should add Ansible role to assigned': {
    state: successState,
    action: {
      type: ANSIBLE_ROLES_ADD,
      payload: { role: ansibleRolesLong[8] },
    },
  },
  'should remove Ansible role from assigned': {
    state: successState,
    action: {
      type: ANSIBLE_ROLES_REMOVE,
      payload: { role: ansibleRolesLong[5] },
    },
  },
  'should change pagination for assigned roles': {
    state: successState,
    action: {
      type: ANSIBLE_ROLES_ASSIGNED_PAGE_CHANGE,
      payload: { pagination: { page: 20, perPage: 5 } },
    },
  },
};

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

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
foreman_ansible-6.1.1 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-6.0.2 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-6.1.0 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-6.0.1 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-5.1.3 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-6.0.0 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-5.1.2 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-5.1.1 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-5.1.0 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-4.0.3.5 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-4.0.3.4 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-4.0.3.3 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-4.0.3.2 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-5.0.1 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-4.0.5 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-4.0.3.1 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-4.0.4 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-5.0.0 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-4.0.3 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-4.0.2 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js