Sha256: b16bb15af33d6a897731ac2d56dd7431fef157eab29b487ffe0d21851191d0af
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 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, 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman_ansible-6.2.0 | webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js |