diff options
Diffstat (limited to 'spec/frontend/packages_and_registries/shared/utils_spec.js')
-rw-r--r-- | spec/frontend/packages_and_registries/shared/utils_spec.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/frontend/packages_and_registries/shared/utils_spec.js b/spec/frontend/packages_and_registries/shared/utils_spec.js index d81cdbfd8bd..1dc6bb261de 100644 --- a/spec/frontend/packages_and_registries/shared/utils_spec.js +++ b/spec/frontend/packages_and_registries/shared/utils_spec.js @@ -3,6 +3,7 @@ import { keyValueToFilterToken, searchArrayToFilterTokens, extractFilterAndSorting, + extractPageInfo, beautifyPath, getCommitLink, } from '~/packages_and_registries/shared/utils'; @@ -61,6 +62,21 @@ describe('Packages And Registries shared utils', () => { ); }); + describe('extractPageInfo', () => { + it.each` + after | before | result + ${null} | ${null} | ${{ after: null, before: null }} + ${'123'} | ${null} | ${{ after: '123', before: null }} + ${null} | ${'123'} | ${{ after: null, before: '123' }} + `('returns pagination objects', ({ after, before, result }) => { + const queryObject = { + after, + before, + }; + expect(extractPageInfo(queryObject)).toStrictEqual(result); + }); + }); + describe('beautifyPath', () => { it('returns a string with spaces around /', () => { expect(beautifyPath('foo/bar')).toBe('foo / bar'); |