From 14bd99196a473b24c5d69730828e6e7af43a49fa Mon Sep 17 00:00:00 2001 From: Buck Doyle Date: Thu, 27 May 2021 13:45:34 -0500 Subject: [PATCH] Change fuzzy search to search all namespaces Thanks to @apollo13 for reporting this in #10101. --- ui/app/components/global-search/control.js | 1 + ui/tests/acceptance/search-test.js | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ui/app/components/global-search/control.js b/ui/app/components/global-search/control.js index 248fd5fb6..ea291d978 100644 --- a/ui/app/components/global-search/control.js +++ b/ui/app/components/global-search/control.js @@ -46,6 +46,7 @@ export default class GlobalSearchControl extends Component { body: JSON.stringify({ Text: string, Context: 'all', + Namespace: '*', }), }); diff --git a/ui/tests/acceptance/search-test.js b/ui/tests/acceptance/search-test.js index 675d287f3..917ca17bd 100644 --- a/ui/tests/acceptance/search-test.js +++ b/ui/tests/acceptance/search-test.js @@ -83,11 +83,21 @@ module('Acceptance | search', function(hooks) { await Layout.navbar.search.groups[4].options[0].click(); assert.equal(currentURL(), '/csi/plugins/xyz-plugin'); - const featureDetectionQueries = server.pretender.handledRequests - .filterBy('url', '/v1/search/fuzzy') + const fuzzySearchQueries = server.pretender.handledRequests + .filterBy('url', '/v1/search/fuzzy'); + + const featureDetectionQueries = fuzzySearchQueries .filter(request => request.requestBody.includes('feature-detection-query')); - assert.equal(featureDetectionQueries.length, 1, 'expect the feature detection query to only run once'); + assert.ok(featureDetectionQueries.length, 1, 'expect the feature detection query to only run once'); + + const realFuzzySearchQuery = fuzzySearchQueries[1]; + + assert.deepEqual(JSON.parse(realFuzzySearchQuery.requestBody), { + 'Context': 'all', + 'Namespace': '*', + 'Text': 'xy' + }); }); test('search does not perform a request when only one character has been entered', async function(assert) {