From 0e2c81f1fa04f99702fc5bfd927ab913d2b78009 Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Fri, 31 Mar 2023 13:41:01 -0700 Subject: [PATCH] Separate tests for ip/strings --- .../providers/value_suggestion_provider.test.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugins/unified_search/public/autocomplete/providers/value_suggestion_provider.test.ts b/src/plugins/unified_search/public/autocomplete/providers/value_suggestion_provider.test.ts index f0b769d97c42f2..66f77450bd2d21 100644 --- a/src/plugins/unified_search/public/autocomplete/providers/value_suggestion_provider.test.ts +++ b/src/plugins/unified_search/public/autocomplete/providers/value_suggestion_provider.test.ts @@ -98,9 +98,9 @@ describe('FieldSuggestions', () => { expect(http.fetch).not.toHaveBeenCalled(); }); - it('should otherwise request suggestions', async () => { + it('should request suggestions for strings', async () => { const [field] = stubFields.filter( - ({ type, aggregatable }) => (type === 'string' || type === 'ip') && aggregatable + ({ type, aggregatable }) => type === 'string' && aggregatable ); await getValueSuggestions({ @@ -113,6 +113,19 @@ describe('FieldSuggestions', () => { expect(http.fetch).toHaveBeenCalled(); }); + it('should request suggestions for ips', async () => { + const [field] = stubFields.filter(({ type, aggregatable }) => type === 'ip' && aggregatable); + + await getValueSuggestions({ + indexPattern: stubIndexPattern, + field, + query: '', + useTimeRange: false, + }); + + expect(http.fetch).toHaveBeenCalled(); + }); + it('should cache results if using the same index/field/query/filter', async () => { const [field] = stubFields.filter( ({ type, aggregatable }) => type === 'string' && aggregatable