summaryrefslogtreecommitdiff
path: root/spec/javascripts/clusters
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-11-06 10:14:29 -0600
committerEric Eastwood <contact@ericeastwood.com>2017-11-06 10:14:29 -0600
commit31cea0333576cbe17171b2f2f65186612bbb3130 (patch)
treeafefca2e03f0a0da9f6362e42485b64615ffd8be /spec/javascripts/clusters
parent802e6653de7c67def245d86244f9223431618189 (diff)
parentf4fb0340094508106113c0c7c22c865fa7c73f7f (diff)
downloadgitlab-ce-31cea0333576cbe17171b2f2f65186612bbb3130.tar.gz
Merge branch '36629-35958-add-cluster-application-section' into add-ingress-to-cluster-applications
Conflicts: app/assets/javascripts/clusters/clusters_bundle.js app/assets/javascripts/clusters/components/application_row.vue app/assets/javascripts/clusters/services/clusters_service.js
Diffstat (limited to 'spec/javascripts/clusters')
-rw-r--r--spec/javascripts/clusters/clusters_bundle_spec.js48
-rw-r--r--spec/javascripts/clusters/components/application_row_spec.js42
-rw-r--r--spec/javascripts/clusters/stores/clusters_store_spec.js3
3 files changed, 81 insertions, 12 deletions
diff --git a/spec/javascripts/clusters/clusters_bundle_spec.js b/spec/javascripts/clusters/clusters_bundle_spec.js
index 26d230ce414..86e9cb22be8 100644
--- a/spec/javascripts/clusters/clusters_bundle_spec.js
+++ b/spec/javascripts/clusters/clusters_bundle_spec.js
@@ -104,7 +104,21 @@ describe('Clusters', () => {
describe('updateContainer', () => {
describe('when creating cluster', () => {
it('should show the creating container', () => {
- cluster.updateContainer('creating');
+ cluster.updateContainer(null, 'creating');
+
+ expect(
+ cluster.creatingContainer.classList.contains('hidden'),
+ ).toBeFalsy();
+ expect(
+ cluster.successContainer.classList.contains('hidden'),
+ ).toBeTruthy();
+ expect(
+ cluster.errorContainer.classList.contains('hidden'),
+ ).toBeTruthy();
+ });
+
+ it('should continue to show `creating` banner with subsequent updates of the same status', () => {
+ cluster.updateContainer('creating', 'creating');
expect(
cluster.creatingContainer.classList.contains('hidden'),
@@ -120,7 +134,7 @@ describe('Clusters', () => {
describe('when cluster is created', () => {
it('should show the success container', () => {
- cluster.updateContainer('created');
+ cluster.updateContainer(null, 'created');
expect(
cluster.creatingContainer.classList.contains('hidden'),
@@ -132,11 +146,25 @@ describe('Clusters', () => {
cluster.errorContainer.classList.contains('hidden'),
).toBeTruthy();
});
+
+ it('should not show a banner when status is already `created`', () => {
+ cluster.updateContainer('created', 'created');
+
+ expect(
+ cluster.creatingContainer.classList.contains('hidden'),
+ ).toBeTruthy();
+ expect(
+ cluster.successContainer.classList.contains('hidden'),
+ ).toBeTruthy();
+ expect(
+ cluster.errorContainer.classList.contains('hidden'),
+ ).toBeTruthy();
+ });
});
describe('when cluster has error', () => {
it('should show the error container', () => {
- cluster.updateContainer('errored', 'this is an error');
+ cluster.updateContainer(null, 'errored', 'this is an error');
expect(
cluster.creatingContainer.classList.contains('hidden'),
@@ -152,6 +180,20 @@ describe('Clusters', () => {
cluster.errorReasonContainer.textContent,
).toContain('this is an error');
});
+
+ it('should show `error` banner when previously `creating`', () => {
+ cluster.updateContainer('creating', 'errored');
+
+ expect(
+ cluster.creatingContainer.classList.contains('hidden'),
+ ).toBeTruthy();
+ expect(
+ cluster.successContainer.classList.contains('hidden'),
+ ).toBeTruthy();
+ expect(
+ cluster.errorContainer.classList.contains('hidden'),
+ ).toBeFalsy();
+ });
});
});
diff --git a/spec/javascripts/clusters/components/application_row_spec.js b/spec/javascripts/clusters/components/application_row_spec.js
index ba38ed6f180..392cebc5e35 100644
--- a/spec/javascripts/clusters/components/application_row_spec.js
+++ b/spec/javascripts/clusters/components/application_row_spec.js
@@ -1,6 +1,8 @@
import Vue from 'vue';
import eventHub from '~/clusters/event_hub';
import {
+ APPLICATION_NOT_INSTALLABLE,
+ APPLICATION_SCHEDULED,
APPLICATION_INSTALLABLE,
APPLICATION_INSTALLING,
APPLICATION_INSTALLED,
@@ -60,7 +62,18 @@ describe('Application Row', () => {
expect(vm.installButtonLabel).toBeUndefined();
});
- it('has enabled "Install" when `status=installable`', () => {
+ it('has disabled "Install" when APPLICATION_NOT_INSTALLABLE', () => {
+ vm = mountComponent(ApplicationRow, {
+ ...DEFAULT_APPLICATION_STATE,
+ status: APPLICATION_NOT_INSTALLABLE,
+ });
+
+ expect(vm.installButtonLabel).toEqual('Install');
+ expect(vm.installButtonLoading).toEqual(false);
+ expect(vm.installButtonDisabled).toEqual(true);
+ });
+
+ it('has enabled "Install" when APPLICATION_INSTALLABLE', () => {
vm = mountComponent(ApplicationRow, {
...DEFAULT_APPLICATION_STATE,
status: APPLICATION_INSTALLABLE,
@@ -71,7 +84,18 @@ describe('Application Row', () => {
expect(vm.installButtonDisabled).toEqual(false);
});
- it('has loading "Installing" when `status=installing`', () => {
+ it('has loading "Installing" when APPLICATION_SCHEDULED', () => {
+ vm = mountComponent(ApplicationRow, {
+ ...DEFAULT_APPLICATION_STATE,
+ status: APPLICATION_SCHEDULED,
+ });
+
+ expect(vm.installButtonLabel).toEqual('Installing');
+ expect(vm.installButtonLoading).toEqual(true);
+ expect(vm.installButtonDisabled).toEqual(true);
+ });
+
+ it('has loading "Installing" when APPLICATION_INSTALLING', () => {
vm = mountComponent(ApplicationRow, {
...DEFAULT_APPLICATION_STATE,
status: APPLICATION_INSTALLING,
@@ -82,7 +106,7 @@ describe('Application Row', () => {
expect(vm.installButtonDisabled).toEqual(true);
});
- it('has disabled "Installed" when `status=installed`', () => {
+ it('has disabled "Installed" when APPLICATION_INSTALLED', () => {
vm = mountComponent(ApplicationRow, {
...DEFAULT_APPLICATION_STATE,
status: APPLICATION_INSTALLED,
@@ -93,7 +117,7 @@ describe('Application Row', () => {
expect(vm.installButtonDisabled).toEqual(true);
});
- it('has disabled "Install" when `status=error`', () => {
+ it('has disabled "Install" when APPLICATION_ERROR', () => {
vm = mountComponent(ApplicationRow, {
...DEFAULT_APPLICATION_STATE,
status: APPLICATION_ERROR,
@@ -104,7 +128,7 @@ describe('Application Row', () => {
expect(vm.installButtonDisabled).toEqual(true);
});
- it('has loading "Install" when `requestStatus=loading`', () => {
+ it('has loading "Install" when REQUEST_LOADING', () => {
vm = mountComponent(ApplicationRow, {
...DEFAULT_APPLICATION_STATE,
status: APPLICATION_INSTALLABLE,
@@ -116,7 +140,7 @@ describe('Application Row', () => {
expect(vm.installButtonDisabled).toEqual(true);
});
- it('has disabled "Install" when `requestStatus=success`', () => {
+ it('has disabled "Install" when REQUEST_SUCCESS', () => {
vm = mountComponent(ApplicationRow, {
...DEFAULT_APPLICATION_STATE,
status: APPLICATION_INSTALLABLE,
@@ -128,7 +152,7 @@ describe('Application Row', () => {
expect(vm.installButtonDisabled).toEqual(true);
});
- it('has enabled "Install" when `requestStatus=error` (so you can try installing again)', () => {
+ it('has enabled "Install" when REQUEST_FAILURE (so you can try installing again)', () => {
vm = mountComponent(ApplicationRow, {
...DEFAULT_APPLICATION_STATE,
status: APPLICATION_INSTALLABLE,
@@ -181,7 +205,7 @@ describe('Application Row', () => {
expect(generalErrorMessage).toBeNull();
});
- it('shows status reason when `status=error`', () => {
+ it('shows status reason when APPLICATION_ERROR', () => {
const statusReason = 'We broke it 0.0';
vm = mountComponent(ApplicationRow, {
...DEFAULT_APPLICATION_STATE,
@@ -195,7 +219,7 @@ describe('Application Row', () => {
expect(statusErrorMessage.textContent.trim()).toEqual(statusReason);
});
- it('shows request reason when `requestStatus=error`', () => {
+ it('shows request reason when REQUEST_FAILURE', () => {
const requestReason = 'We broke thre request 0.0';
vm = mountComponent(ApplicationRow, {
...DEFAULT_APPLICATION_STATE,
diff --git a/spec/javascripts/clusters/stores/clusters_store_spec.js b/spec/javascripts/clusters/stores/clusters_store_spec.js
index 9f9d63434f7..cb8b3d38e2e 100644
--- a/spec/javascripts/clusters/stores/clusters_store_spec.js
+++ b/spec/javascripts/clusters/stores/clusters_store_spec.js
@@ -62,18 +62,21 @@ describe('Clusters Store', () => {
statusReason: mockResponseData.status_reason,
applications: {
helm: {
+ title: 'Helm Tiller',
status: mockResponseData.applications[0].status,
statusReason: mockResponseData.applications[0].status_reason,
requestStatus: null,
requestReason: null,
},
ingress: {
+ title: 'Ingress',
status: mockResponseData.applications[1].status,
statusReason: mockResponseData.applications[1].status_reason,
requestStatus: null,
requestReason: null,
},
runner: {
+ title: 'GitLab Runner',
status: mockResponseData.applications[2].status,
statusReason: mockResponseData.applications[2].status_reason,
requestStatus: null,