diff options
Diffstat (limited to 'spec/frontend/ci/common/private/jobs_filtered_search/utils_spec.js')
-rw-r--r-- | spec/frontend/ci/common/private/jobs_filtered_search/utils_spec.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/frontend/ci/common/private/jobs_filtered_search/utils_spec.js b/spec/frontend/ci/common/private/jobs_filtered_search/utils_spec.js new file mode 100644 index 00000000000..8f6d2368bf4 --- /dev/null +++ b/spec/frontend/ci/common/private/jobs_filtered_search/utils_spec.js @@ -0,0 +1,22 @@ +import { validateQueryString } from '~/ci/common/private/jobs_filtered_search/utils'; + +describe('Filtered search utils', () => { + describe('validateQueryString', () => { + it.each` + queryStringObject | expected + ${{ statuses: 'SUCCESS' }} | ${{ statuses: 'SUCCESS' }} + ${{ statuses: 'failed' }} | ${{ statuses: 'FAILED' }} + ${{ runnerTypes: 'instance_type' }} | ${{ runnerTypes: 'INSTANCE_TYPE' }} + ${{ runnerTypes: 'wrong_runner_type' }} | ${null} + ${{ statuses: 'SUCCESS', runnerTypes: 'instance_type' }} | ${{ statuses: 'SUCCESS', runnerTypes: 'INSTANCE_TYPE' }} + ${{ wrong: 'SUCCESS' }} | ${null} + ${{ statuses: 'wrong' }} | ${null} + ${{ wrong: 'wrong' }} | ${null} + `( + 'when provided $queryStringObject, the expected result is $expected', + ({ queryStringObject, expected }) => { + expect(validateQueryString(queryStringObject)).toEqual(expected); + }, + ); + }); +}); |