Sha256: d4b8a721ac348b21227226fefd3922690bc87cd0543db76f26d3747bd801e12f

Contents?: true

Size: 1.61 KB

Versions: 65

Compression:

Stored size: 1.61 KB

Contents

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

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,
} 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] },
    },
  },
};

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

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
foreman_ansible-15.0.2 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-15.0.1 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-15.0.0 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-14.2.2 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-14.2.1 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-13.0.7 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-14.2.0 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-14.1.1 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-14.1.0 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-13.0.5 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-14.0.0 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-13.0.4 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-13.0.3 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-13.0.2 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-13.0.1 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-13.0.0 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-12.0.7 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-10.4.4 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-7.1.8 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js
foreman_ansible-12.0.6 webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js