Skip to content

Commit

Permalink
adjust jest test
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiqueclarke committed Jan 23, 2023
1 parent 1ebdd24 commit d1c3adf
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { DataStream } from '../runtime_types';
import { ConfigKey, DataStream } from '../runtime_types';
import { formatSyntheticsPolicy } from './format_synthetics_policy';

describe('formatSyntheticsPolicy', () => {
Expand Down Expand Up @@ -499,8 +499,11 @@ describe('formatSyntheticsPolicy', () => {
});
});

it('formats http policy', () => {
const { formattedPolicy } = formatSyntheticsPolicy(testNewPolicy, DataStream.HTTP, httpPolicy);
it.each([true, false])('formats http policy', (isTLSEnabled) => {
const { formattedPolicy } = formatSyntheticsPolicy(testNewPolicy, DataStream.HTTP, {
...httpPolicy,
[ConfigKey.METADATA]: { is_tls_enabled: isTLSEnabled },
});

expect(formattedPolicy).toEqual({
enabled: true,
Expand All @@ -518,7 +521,7 @@ describe('formatSyntheticsPolicy', () => {
vars: {
__ui: {
type: 'yaml',
value: '{"is_tls_enabled":false,"is_zip_url_tls_enabled":false}',
value: `{"is_tls_enabled":${isTLSEnabled}}`,
},
'check.request.body': {
type: 'yaml',
Expand Down Expand Up @@ -628,11 +631,11 @@ describe('formatSyntheticsPolicy', () => {
},
'ssl.supported_protocols': {
type: 'yaml',
value: '["TLSv1.1","TLSv1.2","TLSv1.3"]',
value: isTLSEnabled ? '["TLSv1.1","TLSv1.2","TLSv1.3"]' : null,
},
'ssl.verification_mode': {
type: 'text',
value: 'full',
value: isTLSEnabled ? 'full' : null,
},
tags: {
type: 'yaml',
Expand Down Expand Up @@ -1287,7 +1290,7 @@ const httpPolicy: any = {
journey_id: '',
hash: '',
id: '51ccd9d9-fc3f-4718-ba9d-b6ef80e73fc5',
__ui: { is_tls_enabled: false, is_zip_url_tls_enabled: false },
__ui: { is_tls_enabled: false },
urls: 'https://www.google.com',
max_redirects: '0',
'url.port': null,
Expand Down

0 comments on commit d1c3adf

Please sign in to comment.