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>2023-05-03 06:11:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-03 06:11:15 +0300
commit8d94a37915dfc305c8217fe7e8e4d00928aa88cf (patch)
tree6ba2fd8147149daa2f0b696fe07bec12bc2a78a5 /spec/frontend/packages_and_registries
parenta0754ad291e60e9411897ae4e05e01a600037ee9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/packages_and_registries')
-rw-r--r--spec/frontend/packages_and_registries/dependency_proxy/app_spec.js1
-rw-r--r--spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js14
-rw-r--r--spec/frontend/packages_and_registries/dependency_proxy/components/manifest_row_spec.js51
-rw-r--r--spec/frontend/packages_and_registries/dependency_proxy/mock_data.js4
4 files changed, 61 insertions, 9 deletions
diff --git a/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js b/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js
index 2e7195aa59b..0e383e551d0 100644
--- a/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js
+++ b/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js
@@ -165,6 +165,7 @@ describe('DependencyProxyApp', () => {
it('shows list', () => {
expect(findManifestList().props()).toMatchObject({
+ dependencyProxyImagePrefix: proxyData().dependencyProxyImagePrefix,
manifests: proxyManifests(),
pagination: pagination(),
});
diff --git a/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js b/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js
index 0d8af42bae3..4149f728cd8 100644
--- a/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js
+++ b/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js
@@ -3,6 +3,7 @@ import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import ManifestRow from '~/packages_and_registries/dependency_proxy/components/manifest_row.vue';
import Component from '~/packages_and_registries/dependency_proxy/components/manifests_list.vue';
import {
+ proxyData,
proxyManifests,
pagination,
} from 'jest/packages_and_registries/dependency_proxy/mock_data';
@@ -11,6 +12,7 @@ describe('Manifests List', () => {
let wrapper;
const defaultProps = {
+ dependencyProxyImagePrefix: proxyData().dependencyProxyImagePrefix,
manifests: proxyManifests(),
pagination: pagination(),
loading: false,
@@ -42,9 +44,15 @@ describe('Manifests List', () => {
it('binds a manifest to each row', () => {
createComponent();
- expect(findRows().at(0).props()).toMatchObject({
- manifest: defaultProps.manifests[0],
- });
+ expect(findRows().at(0).props('manifest')).toBe(defaultProps.manifests[0]);
+ });
+
+ it('binds a dependencyProxyImagePrefix to each row', () => {
+ createComponent();
+
+ expect(findRows().at(0).props('dependencyProxyImagePrefix')).toBe(
+ proxyData().dependencyProxyImagePrefix,
+ );
});
describe('loading', () => {
diff --git a/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_row_spec.js b/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_row_spec.js
index ace5ce3a58d..5f47a1b8098 100644
--- a/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_row_spec.js
+++ b/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_row_spec.js
@@ -1,15 +1,17 @@
import { GlSprintf } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
+import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import ListItem from '~/vue_shared/components/registry/list_item.vue';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import Component from '~/packages_and_registries/dependency_proxy/components/manifest_row.vue';
import { MANIFEST_PENDING_DESTRUCTION_STATUS } from '~/packages_and_registries/dependency_proxy/constants';
-import { proxyManifests } from 'jest/packages_and_registries/dependency_proxy/mock_data';
+import { proxyData, proxyManifests } from 'jest/packages_and_registries/dependency_proxy/mock_data';
describe('Manifest Row', () => {
let wrapper;
const defaultProps = {
+ dependencyProxyImagePrefix: proxyData().dependencyProxyImagePrefix,
manifest: proxyManifests()[0],
};
@@ -24,8 +26,10 @@ describe('Manifest Row', () => {
});
};
+ const findClipboardButton = () => wrapper.findComponent(ClipboardButton);
const findListItem = () => wrapper.findComponent(ListItem);
const findCachedMessages = () => wrapper.findByTestId('cached-message');
+ const findDigest = () => wrapper.findByTestId('manifest-row-short-digest');
const findTimeAgoTooltip = () => wrapper.findComponent(TimeagoTooltip);
const findStatus = () => wrapper.findByTestId('status');
@@ -38,12 +42,18 @@ describe('Manifest Row', () => {
expect(findListItem().exists()).toBe(true);
});
- it('displays the name', () => {
- expect(wrapper.text()).toContain('alpine');
+ it('displays the name with tag & digest', () => {
+ expect(wrapper.text()).toContain('alpine:latest');
+ expect(findDigest().text()).toMatchInterpolatedText('Digest: 995efde');
});
- it('displays the version', () => {
- expect(wrapper.text()).toContain('latest');
+ it('displays the name & digest for manifests that contain digest in image name', () => {
+ createComponent({
+ ...defaultProps,
+ manifest: proxyManifests()[1],
+ });
+ expect(wrapper.text()).toContain('alpine');
+ expect(findDigest().text()).toMatchInterpolatedText('Digest: e95efde');
});
it('displays the cached time', () => {
@@ -82,4 +92,35 @@ describe('Manifest Row', () => {
expect(findStatus().text()).toBe('Scheduled for deletion');
});
});
+
+ describe('clipboard button', () => {
+ beforeEach(() => {
+ createComponent();
+ });
+
+ it('exists', () => {
+ expect(findClipboardButton().exists()).toBe(true);
+ });
+
+ it('passes the correct title prop', () => {
+ expect(findClipboardButton().attributes('title')).toBe(Component.i18n.copyImagePathTitle);
+ });
+
+ it('has the correct copy text when image name contains tag name', () => {
+ expect(findClipboardButton().attributes('text')).toBe(
+ 'gdk.test:3000/private-group/dependency_proxy/containers/alpine:latest',
+ );
+ });
+
+ it('has the correct copy text when image name contains digest', () => {
+ createComponent({
+ ...defaultProps,
+ manifest: proxyManifests()[1],
+ });
+
+ expect(findClipboardButton().attributes('text')).toBe(
+ 'gdk.test:3000/private-group/dependency_proxy/containers/alpine@sha256:e95efde2e81b21d1ea7066aa77a59298a62a9e9fbb4b77f36c189774ec9b1089',
+ );
+ });
+ });
});
diff --git a/spec/frontend/packages_and_registries/dependency_proxy/mock_data.js b/spec/frontend/packages_and_registries/dependency_proxy/mock_data.js
index 37c8eb669ba..4d0be0a0c09 100644
--- a/spec/frontend/packages_and_registries/dependency_proxy/mock_data.js
+++ b/spec/frontend/packages_and_registries/dependency_proxy/mock_data.js
@@ -11,13 +11,15 @@ export const proxyManifests = () => [
{
id: 'proxy-1',
createdAt: '2021-09-22T09:45:28Z',
+ digest: 'sha256:995efde2e81b21d1ea7066aa77a59298a62a9e9fbb4b77f36c189774ec9b1089',
imageName: 'alpine:latest',
status: 'DEFAULT',
},
{
id: 'proxy-2',
createdAt: '2021-09-21T09:45:28Z',
- imageName: 'alpine:stable',
+ digest: 'sha256:e95efde2e81b21d1ea7066aa77a59298a62a9e9fbb4b77f36c189774ec9b1089',
+ imageName: 'alpine:sha256:e95efde2e81b21d1ea7066aa77a59298a62a9e9fbb4b77f36c189774ec9b1089',
status: 'DEFAULT',
},
];