Skip to content

Commit

Permalink
Fix params logic missing after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed Nov 11, 2024
1 parent f19e521 commit 9147041
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ describe('autocomplete.suggest', () => {
for (const fn of scalarFunctionDefinitions) {
// skip this fn for the moment as it's quite hard to test
// Add match in the text when the autocomplete is ready https://github.com/elastic/kibana/issues/196995
if (!['bucket', 'date_extract', 'date_diff', 'case', 'match'].includes(fn.name)) {
if (!['bucket', 'date_extract', 'date_diff', 'case', 'match', 'qstr'].includes(fn.name)) {
test(`${fn.name}`, async () => {
const testedCases = new Set<string>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,28 +314,30 @@ describe('quick fixes logic', () => {
{ equalityCheck: 'include', ...options }
);
}
// for (const fn of getAllFunctions({ type: 'agg' })) {
// // add an A to the function name to make it invalid
// testQuickFixes(
// `FROM index | STATS ${BROKEN_PREFIX}${fn.name}()`,
// [fn.name].map(toFunctionSignature),
// { equalityCheck: 'include', ...options }
// );
// testQuickFixes(
// `FROM index | STATS var0 = ${BROKEN_PREFIX}${fn.name}()`,
// [fn.name].map(toFunctionSignature),
// { equalityCheck: 'include', ...options }
// );
// }
// // it should preserve the arguments
// testQuickFixes(`FROM index | EVAL rAund(numberField)`, ['round(numberField)'], {
// equalityCheck: 'include',
// ...options,
// });
// testQuickFixes(`FROM index | STATS AVVG(numberField)`, ['avg(numberField)'], {
// equalityCheck: 'include',
// ...options,
// });
for (const fn of getAllFunctions({ type: 'agg' })) {
if (['match', 'qstr', '?'].includes(fn.name)) continue;

// add an A to the function name to make it invalid
testQuickFixes(
`FROM index | STATS ${BROKEN_PREFIX}${fn.name}()`,
[fn.name].map(toFunctionSignature),
{ equalityCheck: 'include', ...options }
);
testQuickFixes(
`FROM index | STATS var0 = ${BROKEN_PREFIX}${fn.name}()`,
[fn.name].map(toFunctionSignature),
{ equalityCheck: 'include', ...options }
);
}
// it should preserve the arguments
testQuickFixes(`FROM index | EVAL rAund(numberField)`, ['round(numberField)'], {
equalityCheck: 'include',
...options,
});
testQuickFixes(`FROM index | STATS AVVG(numberField)`, ['avg(numberField)'], {
equalityCheck: 'include',
...options,
});
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ function validateFunction({
if (fn.incomplete) {
return messages;
}
if (isFunctionOperatorParam(fn)) {
return messages;
}
const fnDefinition = getFunctionDefinition(fn.name)!;

const isFnSupported = isSupportedFunction(fn.name, parentCommand, parentOption);
Expand Down

0 comments on commit 9147041

Please sign in to comment.