Commit d451d002 authored by Jannik Lehmann's avatar Jannik Lehmann

Refactor utils spec

parent 82b6d9fd
export const mockSecurityFeatures = [
{
name: 'SAST',
type: 'SAST',
},
];
export const mockComplianceFeatures = [
{
name: 'LICENSE_COMPLIANCE',
type: 'LICENSE_COMPLIANCE',
},
];
export const mockFeaturesWithSecondary = [
{
name: 'DAST',
type: 'DAST',
secondary: {
type: 'DAST PROFILES',
name: 'DAST PROFILES',
},
},
];
export const mockInvalidCustomFeature = [
{
foo: 'bar',
},
];
export const mockValidCustomFeature = [
{
name: 'SAST',
type: 'SAST',
customfield: 'customvalue',
},
];
export const expectedOutputDefault = {
augmentedSecurityFeatures: mockSecurityFeatures,
augmentedComplianceFeatures: mockComplianceFeatures,
};
export const expectedOutputSecondary = {
augmentedSecurityFeatures: mockSecurityFeatures,
augmentedComplianceFeatures: mockFeaturesWithSecondary,
};
export const expectedOutputCustomFeature = {
augmentedSecurityFeatures: mockValidCustomFeature,
augmentedComplianceFeatures: mockComplianceFeatures,
};
import { augmentFeatures } from '~/security_configuration/utils'; import { augmentFeatures } from '~/security_configuration/utils';
import {
mockSecurityFeatures, const mockSecurityFeatures = [
mockComplianceFeatures, {
mockFeaturesWithSecondary, name: 'SAST',
mockInvalidCustomFeature, type: 'SAST',
mockValidCustomFeature, },
expectedOutputCustomFeature, ];
expectedOutputDefault,
expectedOutputSecondary, const mockComplianceFeatures = [
} from './utils_mocks'; {
name: 'LICENSE_COMPLIANCE',
type: 'LICENSE_COMPLIANCE',
},
];
const mockFeaturesWithSecondary = [
{
name: 'DAST',
type: 'DAST',
secondary: {
type: 'DAST PROFILES',
name: 'DAST PROFILES',
},
},
];
const mockInvalidCustomFeature = [
{
foo: 'bar',
},
];
const mockValidCustomFeature = [
{
name: 'SAST',
type: 'SAST',
customfield: 'customvalue',
},
];
const expectedOutputDefault = {
augmentedSecurityFeatures: mockSecurityFeatures,
augmentedComplianceFeatures: mockComplianceFeatures,
};
const expectedOutputSecondary = {
augmentedSecurityFeatures: mockSecurityFeatures,
augmentedComplianceFeatures: mockFeaturesWithSecondary,
};
const expectedOutputCustomFeature = {
augmentedSecurityFeatures: mockValidCustomFeature,
augmentedComplianceFeatures: mockComplianceFeatures,
};
describe('augmentFeatures', () => { describe('augmentFeatures', () => {
it('augments features array correctly when given an empty array', () => { it('augments features array correctly when given an empty array', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment