Sha256: bcda5ef12d51d5bb1483ba94d626e17b367a0e4c222421eea721b3738311f9fa

Contents?: true

Size: 1.03 KB

Versions: 33

Compression:

Stored size: 1.03 KB

Contents

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

import {
  selectUnassignedRoles,
  selectAssignedRolesPage,
} from '../AnsibleRolesSwitcherSelectors';
import {
  ansibleRolesShort,
  ansibleRolesLong,
} from '../__fixtures__/ansibleRolesData.fixtures';

const stateFactory = obj => ({
  foremanAnsible: {
    ansibleRolesSwitcher: obj,
  },
});

const state1 = {
  results: ansibleRolesShort,
  assignedRoles: [{ id: 2 }, { id: 4 }],
};

const state2 = {
  results: ansibleRolesShort,
  assignedRoles: [],
};

const state3 = {
  assignedRoles: ansibleRolesLong,
  assignedPagination: { page: 2, perPage: 5 },
};

const fixtures = {
  'should return unassigned roles': () =>
    selectUnassignedRoles(stateFactory(state1)),
  'should return all roles when no roles assigned': () =>
    selectUnassignedRoles(stateFactory(state2)),
  'should return requested page': () =>
    selectAssignedRolesPage(stateFactory(state3)),
};

describe('AnsibleRolesSwitcherSelectors', () =>
  testSelectorsSnapshotWithFixtures(fixtures));

Version data entries

33 entries across 33 versions & 1 rubygems

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