-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #37762 - Don't send empty host search query to REX (#11118)
(cherry picked from commit 8cd215e)
- Loading branch information
1 parent
0591e90
commit 60f340c
Showing
2 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
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
44 changes: 44 additions & 0 deletions
44
webpack/components/extensions/HostDetails/Tabs/__tests__/remoteExecutionActions.test.js
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,44 @@ | ||
import { baseParams, buildHostSearch } from '../RemoteExecutionActions'; | ||
|
||
describe('buildHostSearch', () => { | ||
it('Replaces empty string with special search', () => { | ||
const options = { | ||
hostname: 'test', | ||
hostSearch: '', | ||
}; | ||
expect(buildHostSearch(options)).toEqual('set? name'); | ||
}); | ||
it('Composes hostname search when hostSearch is not passed', () => { | ||
const options = { | ||
hostname: 'test', | ||
}; | ||
expect(buildHostSearch(options)).toEqual('name ^ (test)'); | ||
}); | ||
it('Composes hostSearch when hostname is not passed', () => { | ||
const options = { | ||
hostSearch: 'test', | ||
}; | ||
expect(buildHostSearch(options)).toEqual('test'); | ||
}); | ||
}); | ||
|
||
describe('baseParams', () => { | ||
it('Composes base params', () => { | ||
const options = { | ||
feature: 'feature', | ||
hostname: 'hostname', | ||
hostSearch: 'hostSearch', | ||
descriptionFormat: 'descriptionFormat', | ||
inputs: { input: 'input' }, | ||
}; | ||
expect(baseParams(options)).toEqual({ | ||
job_invocation: { | ||
feature: 'feature', | ||
inputs: { input: 'input' }, | ||
description_format: 'descriptionFormat', | ||
search_query: 'hostSearch', | ||
}, | ||
}); | ||
}); | ||
}); | ||
|