add tests for validating project billing status
This commit is contained in:
parent
8b9f31adc2
commit
b394cc31e2
3 changed files with 30 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in a new issue