Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kpollich committed Dec 6, 2023
1 parent 0b90335 commit 3f985ac
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions x-pack/plugins/fleet/common/services/output_helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* 2.0.
*/

import { safeLoad } from 'js-yaml';

import {
getAllowedOutputTypeForPolicy,
outputYmlIncludesReservedPerformanceKey,
Expand Down Expand Up @@ -54,13 +56,13 @@ describe('outputYmlIncludesReservedPerformanceKey', () => {
it('returns true when reserved key is present', () => {
const configYml = `queue.mem.events: 1000`;

expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(true);
expect(outputYmlIncludesReservedPerformanceKey(configYml, safeLoad)).toBe(true);
});

it('returns false when no reserved key is present', () => {
const configYml = `some.random.key: 1000`;

expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(false);
expect(outputYmlIncludesReservedPerformanceKey(configYml, safeLoad)).toBe(false);
});
});

Expand All @@ -72,7 +74,7 @@ describe('outputYmlIncludesReservedPerformanceKey', () => {
events: 1000
`;

expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(true);
expect(outputYmlIncludesReservedPerformanceKey(configYml, safeLoad)).toBe(true);
});

it('returns false when no reserved key is present', () => {
Expand All @@ -82,21 +84,21 @@ describe('outputYmlIncludesReservedPerformanceKey', () => {
key: 1000
`;

expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(false);
expect(outputYmlIncludesReservedPerformanceKey(configYml, safeLoad)).toBe(false);
});
});

describe('plain string', () => {
it('returns true when reserved key is present', () => {
const configYml = `bulk_max_size`;

expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(true);
expect(outputYmlIncludesReservedPerformanceKey(configYml, safeLoad)).toBe(true);
});

it('returns false when no reserved key is present', () => {
const configYml = `just a string`;

expect(outputYmlIncludesReservedPerformanceKey(configYml)).toBe(false);
expect(outputYmlIncludesReservedPerformanceKey(configYml, safeLoad)).toBe(false);
});
});
});

0 comments on commit 3f985ac

Please sign in to comment.