diff options
author | Dennis Tang <dtang@gitlab.com> | 2018-05-23 16:32:09 +0200 |
---|---|---|
committer | Dennis Tang <dtang@gitlab.com> | 2018-05-23 16:32:09 +0200 |
commit | b394cc31e29a153d1d4c93da75e666fa610a8434 (patch) | |
tree | a4c91cd659542cacf3d225d02b4ca26e2673e35a /spec/javascripts/projects | |
parent | 8b9f31adc24e3049ea51d3dcb9a53bbc4cd831d0 (diff) | |
download | gitlab-ce-b394cc31e29a153d1d4c93da75e666fa610a8434.tar.gz |
add tests for validating project billing status
Diffstat (limited to 'spec/javascripts/projects')
3 files changed, 30 insertions, 0 deletions
diff --git a/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown_spec.js b/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown_spec.js index f2417443783..d13d92c94e5 100644 --- a/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown_spec.js +++ b/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown_spec.js @@ -13,6 +13,7 @@ const componentConfig = { const LABELS = { LOADING: 'Fetching projects', + VALIDATING_PROJECT_BILLING: 'Validating project billing status', DEFAULT: 'Select project', EMPTY: 'No projects found', }; @@ -45,6 +46,11 @@ describe('GkeProjectIdDropdown', () => { expect(vm.toggleText).toBe(LABELS.LOADING); }); + it('returns project billing validation text', () => { + vm.isValidatingProjectBilling = true; + expect(vm.toggleText).toBe(LABELS.VALIDATING_PROJECT_BILLING); + }); + it('returns default toggle text', done => vm.$nextTick().then(() => { vm.setItem(emptyProjectMock); diff --git a/spec/javascripts/projects/gke_cluster_dropdowns/stores/actions_spec.js b/spec/javascripts/projects/gke_cluster_dropdowns/stores/actions_spec.js index ea4c96055d7..d9292abc5e8 100644 --- a/spec/javascripts/projects/gke_cluster_dropdowns/stores/actions_spec.js +++ b/spec/javascripts/projects/gke_cluster_dropdowns/stores/actions_spec.js @@ -67,6 +67,19 @@ describe('GCP Cluster Dropdown Store Actions', () => { }); }); + describe('validateProjectBilling', () => { + it('checks project billing status from Google API', done => { + store + .dispatch('validateProjectBilling') + .then(() => { + expect(store.state.projectHasBillingEnabled).toBeTruthy(); + + done(); + }) + .catch(done.fail); + }); + }); + describe('fetchZones', () => { it('fetches zones from Google API', done => { store diff --git a/spec/javascripts/projects/gke_cluster_dropdowns/stores/mutations_spec.js b/spec/javascripts/projects/gke_cluster_dropdowns/stores/mutations_spec.js index 167cc36fe8b..7cef492305b 100644 --- a/spec/javascripts/projects/gke_cluster_dropdowns/stores/mutations_spec.js +++ b/spec/javascripts/projects/gke_cluster_dropdowns/stores/mutations_spec.js @@ -26,6 +26,17 @@ describe('GCP Cluster Dropdown Store Mutations', () => { }); }); + describe('SET_PROJECT_BILLING_STATUS', () => { + it('should set project billing status', () => { + const state = { + projectHasBillingEnabled: null, + }; + mutations.SET_PROJECT_BILLING_STATUS(state, true); + + expect(state.projectHasBillingEnabled).toBeTruthy(); + }); + }); + describe('SET_ZONE', () => { it('should set GCP zone as selectedZone', () => { const state = { |