Change fuzzy search to search all namespaces

Thanks to @apollo13 for reporting this in #10101.
This commit is contained in:
Buck Doyle 2021-05-27 13:45:34 -05:00
parent e618c06076
commit 14bd99196a
No known key found for this signature in database
GPG key ID: 2189EE73C555209C
2 changed files with 14 additions and 3 deletions

View file

@ -46,6 +46,7 @@ export default class GlobalSearchControl extends Component {
body: JSON.stringify({
Text: string,
Context: 'all',
Namespace: '*',
}),
});

View file

@ -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) {