Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-10 17:52:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-10 17:52:44 +0300
commit86a8eee1b8bd43a1fe962905eb97a1f478cc050b (patch)
tree439816bbaf4a0caf16d579223eb9465e0b0daebc /spec/frontend
parent1b517a5a19c4aafc6fa6d738b0ee7c1e4a2cce36 (diff)
Add latest changes from gitlab-org/gitlab@13-6-stable-ee
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/registry/explorer/utils_spec.js17
-rw-r--r--spec/frontend/vue_mr_widget/mr_widget_options_spec.js14
2 files changed, 28 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', () => {
diff --git a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js
index d6f85dcfcc7..cb0006548d4 100644
--- a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js
+++ b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js
@@ -260,6 +260,20 @@ describe('mrWidgetOptions', () => {
});
});
});
+
+ describe('formattedHumanAccess', () => {
+ it('when user is a tool admin but not a member of project', () => {
+ vm.mr.humanAccess = null;
+
+ expect(vm.formattedHumanAccess).toEqual('');
+ });
+
+ it('when user a member of the project', () => {
+ vm.mr.humanAccess = 'Owner';
+
+ expect(vm.formattedHumanAccess).toEqual('owner');
+ });
+ });
});
describe('methods', () => {