Skip to content

Commit

Permalink
[ML] Update tests to have getCreateTransformSettingsRequestBody
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed Sep 30, 2020
1 parent 10e30dd commit b82513e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions x-pack/plugins/transform/public/app/common/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
defaultQuery,
getPreviewTransformRequestBody,
getCreateTransformRequestBody,
getCreateTransformSettingsRequestBody,
getPivotQuery,
isDefaultQuery,
isMatchAllQuery,
Expand Down Expand Up @@ -159,6 +160,7 @@ describe('Transform: Common', () => {
transformDescription: 'the-transform-description',
transformFrequency: '1m',
transformSettingsMaxPageSearchSize: 100,
transformSettingsDocsPerSecond: 400,
destinationIndex: 'the-destination-index',
touched: true,
valid: true,
Expand All @@ -180,11 +182,42 @@ describe('Transform: Common', () => {
},
settings: {
max_page_search_size: 100,
docs_per_second: 400,
},
source: {
index: ['the-index-pattern-title'],
query: { query_string: { default_operator: 'AND', query: 'the-search-query' } },
},
});
});

test('getCreateTransformSettingsRequestBody() with all settings', () => {
const transformDetailsState: StepDetailsExposedState = {
transformSettingsDocsPerSecond: 400,
transformSettingsMaxPageSearchSize: 100,
};

const request = getCreateTransformSettingsRequestBody(transformDetailsState);

expect(request).toEqual({
settings: {
docs_per_second: 400,
max_page_search_size: 100,
},
});
});

test('getCreateTransformSettingsRequestBody() with individual settings', () => {
const transformDetailsState: StepDetailsExposedState = {
transformSettingsDocsPerSecond: 400,
};

const request = getCreateTransformSettingsRequestBody(transformDetailsState);

expect(request).toEqual({
settings: {
docs_per_second: 400,
},
});
});
});

0 comments on commit b82513e

Please sign in to comment.