Sha256: a1408ffe51589841d8af04db4dd6b6ac9035389b0464b9df2b265274b95671e7

Contents?: true

Size: 1.16 KB

Versions: 11

Compression:

Stored size: 1.16 KB

Contents

import { mockFactory } from '../../../../testHelper';
import updateOvalPolicyMutation from '../../../../graphql/mutations/updateOvalPolicy.gql';
import { ovalPolicy } from './OvalPoliciesShow.fixtures';

const updateOvalPolicyMockFactory = mockFactory(
  'updateOvalPolicy',
  updateOvalPolicyMutation
);

export const updatedName = 'updated policy name';

const variables = {
  id: ovalPolicy.id,
  name: updatedName,
  cronLine: ovalPolicy.cronLine,
  description: ovalPolicy.description,
};
const responsePolicy = {
  ovalPolicy: {
    __typename: 'ForemanOpenscap::OvalPolicy',
    id: ovalPolicy.id,
    name: updatedName,
    description: ovalPolicy.description,
    cronLine: ovalPolicy.cronLine,
  },
  errors: [],
};

export const policyUpdateMock = updateOvalPolicyMockFactory(
  variables,
  responsePolicy
);

export const policyUpdateErrorMock = updateOvalPolicyMockFactory(
  variables,
  responsePolicy,
  { errors: [{ message: 'This is an unexpected failure.' }] }
);

export const policyUpdateValidationMock = updateOvalPolicyMockFactory(
  variables,
  {
    ovalPolicy,
    errors: [
      { path: ['attributes', 'name'], message: 'has already been taken' },
    ],
  }
);

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
foreman_openscap-8.0.0 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js
foreman_openscap-7.1.1 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js
foreman_openscap-7.1.0 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js
foreman_openscap-7.0.0 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js
foreman_openscap-6.0.0 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js
foreman_openscap-5.2.3 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js
foreman_openscap-5.2.2 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js
foreman_openscap-5.1.1 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js
foreman_openscap-5.2.1 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js
foreman_openscap-5.2.0 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js
foreman_openscap-5.1.0 webpack/routes/OvalPolicies/OvalPoliciesShow/__tests__/OvalPoliciesEdit.fixtures.js