Skip to content

Commit

Permalink
✅ Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Apr 16, 2024
1 parent 7ee39c2 commit 5401ce6
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,28 @@ describe('autocomplete', () => {
26 /* b column in abs */
);

// suggest both signature types as third argument
testSuggestions('from a | eval auto_bucket(dateField, numberField, ', [
...getFieldNamesByType(['string', 'number']),
...getFunctionSignaturesByReturnType(
'eval',
['string', 'number'],
{ evalMath: true },
undefined,
['auto_bucket']
),
]);

// but fourth argument should only suggest type conditionally on the third argument
for (const type of ['string', 'number']) {
testSuggestions(`from a | eval auto_bucket(dateField, numberField, ${type}Field, `, [
...getFieldNamesByType(type),
...getFunctionSignaturesByReturnType('eval', type, { evalMath: true }, undefined, [
'auto_bucket',
]),
]);
}

// Test suggestions for each possible param, within each signature variation, for each function
for (const fn of evalFunctionsDefinitions) {
// skip this fn for the moment as it's quite hard to test
Expand Down

0 comments on commit 5401ce6

Please sign in to comment.