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>2021-10-13 21:12:40 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-13 21:12:40 +0300
commitcb6a3f5f73097b995d8465c2472ceeab9bbe9497 (patch)
tree29c645739d09cccc5f1629626cc0f0d2b94040bb /spec/frontend/packages_and_registries/dependency_proxy/app_spec.js
parent60be8b19d4772b00110506e4bd6294989915b1e6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/packages_and_registries/dependency_proxy/app_spec.js')
-rw-r--r--spec/frontend/packages_and_registries/dependency_proxy/app_spec.js79
1 files changed, 53 insertions, 26 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 dd14351d4fb..1f0252965b0 100644
--- a/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js
+++ b/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js
@@ -1,4 +1,4 @@
-import { GlAlert, GlFormInputGroup, GlFormGroup, GlSkeletonLoader, GlSprintf } from '@gitlab/ui';
+import { GlFormInputGroup, GlFormGroup, GlSkeletonLoader, GlSprintf } from '@gitlab/ui';
import { createLocalVue } from '@vue/test-utils';
import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper';
@@ -45,7 +45,8 @@ describe('DependencyProxyApp', () => {
});
}
- const findProxyNotAvailableAlert = () => wrapper.findComponent(GlAlert);
+ const findProxyNotAvailableAlert = () => wrapper.findByTestId('proxy-not-available');
+ const findProxyDisabledAlert = () => wrapper.findByTestId('proxy-disabled');
const findClipBoardButton = () => wrapper.findComponent(ClipboardButton);
const findFormGroup = () => wrapper.findComponent(GlFormGroup);
const findFormInputGroup = () => wrapper.findComponent(GlFormInputGroup);
@@ -108,38 +109,64 @@ describe('DependencyProxyApp', () => {
});
describe('when the app is loaded', () => {
- beforeEach(() => {
- createComponent();
- return waitForPromises();
- });
+ describe('when the dependency proxy is enabled', () => {
+ beforeEach(() => {
+ createComponent();
+ return waitForPromises();
+ });
- it('does not render the info alert', () => {
- expect(findProxyNotAvailableAlert().exists()).toBe(false);
- });
+ it('does not render the info alert', () => {
+ expect(findProxyNotAvailableAlert().exists()).toBe(false);
+ });
- it('renders the main area', () => {
- expect(findMainArea().exists()).toBe(true);
- });
+ it('renders the main area', () => {
+ expect(findMainArea().exists()).toBe(true);
+ });
- it('renders a form group with a label', () => {
- expect(findFormGroup().attributes('label')).toBe(DependencyProxyApp.i18n.proxyImagePrefix);
- });
+ it('renders a form group with a label', () => {
+ expect(findFormGroup().attributes('label')).toBe(
+ DependencyProxyApp.i18n.proxyImagePrefix,
+ );
+ });
- it('renders a form input group', () => {
- expect(findFormInputGroup().exists()).toBe(true);
- expect(findFormInputGroup().props('value')).toBe(proxyData().dependencyProxyImagePrefix);
- });
+ it('renders a form input group', () => {
+ expect(findFormInputGroup().exists()).toBe(true);
+ expect(findFormInputGroup().props('value')).toBe(proxyData().dependencyProxyImagePrefix);
+ });
- it('form input group has a clipboard button', () => {
- expect(findClipBoardButton().exists()).toBe(true);
- expect(findClipBoardButton().props()).toMatchObject({
- text: proxyData().dependencyProxyImagePrefix,
- title: DependencyProxyApp.i18n.copyImagePrefixText,
+ it('form input group has a clipboard button', () => {
+ expect(findClipBoardButton().exists()).toBe(true);
+ expect(findClipBoardButton().props()).toMatchObject({
+ text: proxyData().dependencyProxyImagePrefix,
+ title: DependencyProxyApp.i18n.copyImagePrefixText,
+ });
+ });
+
+ it('from group has a description with proxy count', () => {
+ expect(findProxyCountText().text()).toBe('Contains 2 blobs of images (1024 Bytes)');
});
});
+ describe('when the dependency proxy is disabled', () => {
+ beforeEach(() => {
+ createComponent({
+ resolver: jest
+ .fn()
+ .mockResolvedValue(proxyDetailsQuery({ extendSettings: { enabled: false } })),
+ });
+ return waitForPromises();
+ });
- it('from group has a description with proxy count', () => {
- expect(findProxyCountText().text()).toBe('Contains 2 blobs of images (1024 Bytes)');
+ it('does not show the main area', () => {
+ expect(findMainArea().exists()).toBe(false);
+ });
+
+ it('does not show the loader', () => {
+ expect(findSkeletonLoader().exists()).toBe(false);
+ });
+
+ it('shows a proxy disabled alert', () => {
+ expect(findProxyDisabledAlert().text()).toBe(DependencyProxyApp.i18n.proxyDisabledText);
+ });
});
});
});