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:
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.js83
1 files changed, 31 insertions, 52 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 dbe9793fb8c..fe4a2c06f1c 100644
--- a/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js
+++ b/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js
@@ -9,7 +9,7 @@ import {
GlSprintf,
GlEmptyState,
} from '@gitlab/ui';
-import Vue from 'vue';
+import Vue, { nextTick } from 'vue';
import VueApollo from 'vue-apollo';
import MockAdapter from 'axios-mock-adapter';
import createMockApollo from 'helpers/mock_apollo_helper';
@@ -47,7 +47,6 @@ describe('DependencyProxyApp', () => {
const provideDefaults = {
groupPath: 'gitlab-org',
groupId: dummyGrouptId,
- dependencyProxyAvailable: true,
noManifestsIllustration: 'noManifestsIllustration',
};
@@ -74,7 +73,6 @@ describe('DependencyProxyApp', () => {
});
}
- const findProxyNotAvailableAlert = () => wrapper.findByTestId('proxy-not-available');
const findClipBoardButton = () => wrapper.findComponent(ClipboardButton);
const findFormGroup = () => wrapper.findComponent(GlFormGroup);
const findFormInputGroup = () => wrapper.findComponent(GlFormInputGroup);
@@ -103,59 +101,22 @@ describe('DependencyProxyApp', () => {
mock.restore();
});
- describe('when the dependency proxy is not available', () => {
- const createComponentArguments = {
- provide: { ...provideDefaults, dependencyProxyAvailable: false },
- };
-
- it('renders an info alert', () => {
- createComponent(createComponentArguments);
-
- expect(findProxyNotAvailableAlert().text()).toBe(
- DependencyProxyApp.i18n.proxyNotAvailableText,
- );
- });
-
- it('does not render the main area', () => {
- createComponent(createComponentArguments);
-
- expect(findMainArea().exists()).toBe(false);
- });
-
- it('does not call the graphql endpoint', async () => {
- resolver = jest.fn().mockResolvedValue(proxyDetailsQuery());
- createComponent({ ...createComponentArguments });
-
- await waitForPromises();
-
- expect(resolver).not.toHaveBeenCalled();
- });
-
- it('hides the clear cache dropdown list', () => {
- createComponent(createComponentArguments);
-
- expect(findClearCacheDropdownList().exists()).toBe(false);
- });
- });
-
describe('when the dependency proxy is available', () => {
describe('when is loading', () => {
- it('renders the skeleton loader', () => {
+ beforeEach(() => {
createComponent();
+ });
+ it('renders the skeleton loader', () => {
expect(findSkeletonLoader().exists()).toBe(true);
});
- it('does not show the main section', () => {
- createComponent();
-
- expect(findMainArea().exists()).toBe(false);
+ it('does not render a form group with label', () => {
+ expect(findFormGroup().exists()).toBe(false);
});
- it('does not render the info alert', () => {
- createComponent();
-
- expect(findProxyNotAvailableAlert().exists()).toBe(false);
+ it('does not show the main section', () => {
+ expect(findMainArea().exists()).toBe(false);
});
});
@@ -166,10 +127,6 @@ describe('DependencyProxyApp', () => {
return waitForPromises();
});
- it('does not render the info alert', () => {
- expect(findProxyNotAvailableAlert().exists()).toBe(false);
- });
-
it('renders the main area', () => {
expect(findMainArea().exists()).toBe(true);
});
@@ -193,7 +150,7 @@ describe('DependencyProxyApp', () => {
});
});
- it('from group has a description with proxy count', () => {
+ it('form group has a description with proxy count', () => {
expect(findProxyCountText().text()).toBe('Contains 2 blobs of images (1024 Bytes)');
});
@@ -257,6 +214,28 @@ describe('DependencyProxyApp', () => {
});
});
+ describe('triggering page event on list', () => {
+ beforeEach(async () => {
+ findManifestList().vm.$emit('next-page');
+
+ await nextTick();
+ });
+
+ it('re-renders the skeleton loader', () => {
+ expect(findSkeletonLoader().exists()).toBe(true);
+ });
+
+ it('renders form group with label', () => {
+ expect(findFormGroup().attributes('label')).toEqual(
+ expect.stringMatching(DependencyProxyApp.i18n.proxyImagePrefix),
+ );
+ });
+
+ it('does not show the main section', () => {
+ expect(findMainArea().exists()).toBe(false);
+ });
+ });
+
it('shows the clear cache dropdown list', () => {
expect(findClearCacheDropdownList().exists()).toBe(true);