diff options
Diffstat (limited to 'spec/frontend/ci/runner/runner_search_utils_spec.js')
-rw-r--r-- | spec/frontend/ci/runner/runner_search_utils_spec.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/frontend/ci/runner/runner_search_utils_spec.js b/spec/frontend/ci/runner/runner_search_utils_spec.js index 1db8fa1829b..f64b89d47fd 100644 --- a/spec/frontend/ci/runner/runner_search_utils_spec.js +++ b/spec/frontend/ci/runner/runner_search_utils_spec.js @@ -6,6 +6,7 @@ import { fromSearchToVariables, isSearchFiltered, } from 'ee_else_ce/ci/runner/runner_search_utils'; +import { FILTERED_SEARCH_TERM } from '~/vue_shared/components/filtered_search_bar/constants'; import { mockSearchExamples } from './mock_data'; describe('search_params.js', () => { @@ -48,8 +49,8 @@ describe('search_params.js', () => { it('When search params appear as array, they are concatenated', () => { expect(fromUrlQueryToSearch('?search[]=my&search[]=text').filters).toEqual([ - { type: 'filtered-search-term', value: { data: 'my' } }, - { type: 'filtered-search-term', value: { data: 'text' } }, + { type: FILTERED_SEARCH_TERM, value: { data: 'my' } }, + { type: FILTERED_SEARCH_TERM, value: { data: 'text' } }, ]); }); }); @@ -64,12 +65,13 @@ describe('search_params.js', () => { it.each([ 'http://test.host/?status[]=ACTIVE', 'http://test.host/?runner_type[]=INSTANCE_TYPE', + 'http://test.host/?paused[]=true', 'http://test.host/?search=my_text', - ])('When a filter is removed, it is removed from the URL', (initalUrl) => { + ])('When a filter is removed, it is removed from the URL', (initialUrl) => { const search = { filters: [], sort: 'CREATED_DESC' }; const expectedUrl = `http://test.host/`; - expect(fromSearchToUrl(search, initalUrl)).toBe(expectedUrl); + expect(fromSearchToUrl(search, initialUrl)).toBe(expectedUrl); }); it('When unrelated search parameter is present, it does not get removed', () => { @@ -93,7 +95,7 @@ describe('search_params.js', () => { fromSearchToVariables({ filters: [ { - type: 'filtered-search-term', + type: FILTERED_SEARCH_TERM, value: { data: '' }, }, ], @@ -106,11 +108,11 @@ describe('search_params.js', () => { fromSearchToVariables({ filters: [ { - type: 'filtered-search-term', + type: FILTERED_SEARCH_TERM, value: { data: 'something' }, }, { - type: 'filtered-search-term', + type: FILTERED_SEARCH_TERM, value: { data: '' }, }, ], |