diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-10 14:52:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-10 14:52:44 +0000 |
commit | 86a8eee1b8bd43a1fe962905eb97a1f478cc050b (patch) | |
tree | 439816bbaf4a0caf16d579223eb9465e0b0daebc /spec/frontend/registry | |
parent | 1b517a5a19c4aafc6fa6d738b0ee7c1e4a2cce36 (diff) | |
download | gitlab-ce-86a8eee1b8bd43a1fe962905eb97a1f478cc050b.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-ee
Diffstat (limited to 'spec/frontend/registry')
-rw-r--r-- | spec/frontend/registry/explorer/utils_spec.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/spec/frontend/registry/explorer/utils_spec.js b/spec/frontend/registry/explorer/utils_spec.js index 0cd4a1cec29..7a5d6958a09 100644 --- a/spec/frontend/registry/explorer/utils_spec.js +++ b/spec/frontend/registry/explorer/utils_spec.js @@ -8,6 +8,10 @@ describe('Utils', () => { id: 1, }; + beforeEach(() => { + window.gon.relative_url_root = null; + }); + it('returns the fetch url when no ending is passed', () => { expect(pathGenerator(imageDetails)).toBe('/foo/bar/registry/repository/1/tags?format=json'); }); @@ -16,7 +20,7 @@ describe('Utils', () => { expect(pathGenerator(imageDetails, '/foo')).toBe('/foo/bar/registry/repository/1/tags/foo'); }); - it.each` + describe.each` path | name | result ${'foo/foo'} | ${''} | ${'/foo/foo/registry/repository/1/tags?format=json'} ${'foo/foo/foo'} | ${'foo'} | ${'/foo/foo/registry/repository/1/tags?format=json'} @@ -26,8 +30,15 @@ describe('Utils', () => { ${'foo/foo/baz/foo/bar'} | ${'foo/bar'} | ${'/foo/foo/baz/registry/repository/1/tags?format=json'} ${'baz/foo/foo'} | ${'foo'} | ${'/baz/foo/registry/repository/1/tags?format=json'} ${'baz/foo/bar'} | ${'foo'} | ${'/baz/foo/bar/registry/repository/1/tags?format=json'} - `('returns the correct path when path is $path and name is $name', ({ name, path, result }) => { - expect(pathGenerator({ id: 1, name, path })).toBe(result); + `('when path is $path and name is $name', ({ name, path, result }) => { + it('returns the correct value', () => { + expect(pathGenerator({ id: 1, name, path })).toBe(result); + }); + + it('produces a correct relative url', () => { + window.gon.relative_url_root = '/gitlab'; + expect(pathGenerator({ id: 1, name, path })).toBe(`/gitlab${result}`); + }); }); it('returns the url unchanged when imageDetails have no name', () => { |