Skip to content

Commit

Permalink
[serverless] add sorting to Discover CSV tests (#179901)
Browse files Browse the repository at this point in the history
## Summary

Add sorting via api calls.
Update mappings file to load field data.
Update snapshots
  • Loading branch information
wayneseymour authored Apr 3, 2024
1 parent 0eba4ae commit c1d310b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dynamic": false,
"properties": {
"text": {
"type": "text"
"type": "text",
"fielddata": "true"
}
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export default ({ getService }: FtrProviderContext) => {
query: { language: 'kuery', query: '' },
fields: fields.map((field) => ({ field, include_unmapped: 'true' })),
filter: [],
sort: [{ text: 'asc' as SortDirection }],
},
title: 'Untitled discover search',
version: '8.14.0',
Expand All @@ -195,19 +196,19 @@ export default ({ getService }: FtrProviderContext) => {

it('includes an unmapped field to the report', async () => {
const csvFile = await generateCsvReportWithUnmapped(['text', 'unmapped']);
expect((csvFile as string).length).to.be(88);
expect((csvFile as string).length).to.be(92);
expectSnapshot(createPartialCsv(csvFile)).toMatch();
});

it('includes an unmapped nested field to the report', async () => {
const csvFile = await generateCsvReportWithUnmapped(['text', 'nested.unmapped']);
expect((csvFile as string).length).to.be(97);
expect((csvFile as string).length).to.be(101);
expectSnapshot(createPartialCsv(csvFile)).toMatch();
});

it('includes all unmapped fields to the report', async () => {
const csvFile = await generateCsvReportWithUnmapped(['*']);
expect((csvFile as string).length).to.be(120);
expect((csvFile as string).length).to.be(124);
expectSnapshot(createPartialCsv(csvFile)).toMatch();
});
});
Expand Down

0 comments on commit c1d310b

Please sign in to comment.