-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Uptime] Monitor list fix default search behaviour (#147336)
Co-authored-by: Abdul Wahab Zahid <[email protected]> Fixes #147245
- Loading branch information
Showing
2 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...ugins/synthetics/server/legacy_uptime/lib/requests/search/get_query_string_filter.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { getQueryStringFilter } from './get_query_string_filter'; | ||
|
||
describe('get_query_string_filter', () => { | ||
it('should return query string filter', () => { | ||
expect(getQueryStringFilter('test')).toEqual({ | ||
query_string: { | ||
query: '*test* or tags:test*', | ||
fields: [ | ||
'monitor.id.text', | ||
'monitor.name.text', | ||
'url.full.text', | ||
'synthetics.step.name', | ||
'synthetics.journey.name', | ||
], | ||
}, | ||
}); | ||
}); | ||
|
||
it('port filter in case query is number', () => { | ||
expect(getQueryStringFilter('443')).toEqual({ | ||
query_string: { | ||
query: 'url.port:443 or 443', | ||
fields: [ | ||
'monitor.id.text', | ||
'monitor.name.text', | ||
'url.full.text', | ||
'synthetics.step.name', | ||
'synthetics.journey.name', | ||
], | ||
}, | ||
}); | ||
}); | ||
|
||
it('do not wrap if it already has reserved char', () => { | ||
expect(getQueryStringFilter('test*')).toEqual({ | ||
query_string: { | ||
query: 'test*', | ||
fields: [ | ||
'monitor.id.text', | ||
'monitor.name.text', | ||
'url.full.text', | ||
'synthetics.step.name', | ||
'synthetics.journey.name', | ||
], | ||
}, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters