Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Aug 21, 2023
1 parent d5ccd00 commit 3480c52
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/plugins/data/common/search/search_source/search_source.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,22 @@ describe('SearchSource', () => {
const request = searchSource.getSearchRequestBody();
expect(request.script_fields).toEqual({ hello: {}, world: {} });
});

test('ignores scripted fields when scripted fields are disabled', async () => {
searchSource.setField('index', {
...indexPattern,
getComputedFields: () => ({
storedFields: [],
scriptFields: { hello: {}, world: {} },
docvalueFields: [],
}),
} as unknown as DataView);
searchSourceDependencies.scriptedFieldsEnabled = false;
searchSource.setField('fields', ['timestamp', '*']);

const request = searchSource.getSearchRequestBody();
expect(request.script_fields).toEqual({});
});
});

describe('handling for when specific fields are provided', () => {
Expand Down

0 comments on commit 3480c52

Please sign in to comment.