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/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js')
-rw-r--r--spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js112
1 files changed, 35 insertions, 77 deletions
diff --git a/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js b/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js
index 2600415fc9f..f9984091df0 100644
--- a/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js
+++ b/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js
@@ -16,7 +16,6 @@ describe('EksClusterConfigurationForm', () => {
let getters;
let state;
let rolesState;
- let regionsState;
let vpcsState;
let subnetsState;
let keyPairsState;
@@ -24,7 +23,6 @@ describe('EksClusterConfigurationForm', () => {
let instanceTypesState;
let vpcsActions;
let rolesActions;
- let regionsActions;
let subnetsActions;
let keyPairsActions;
let securityGroupsActions;
@@ -46,9 +44,6 @@ describe('EksClusterConfigurationForm', () => {
setNodeCount: jest.fn(),
setGitlabManagedCluster: jest.fn(),
};
- regionsActions = {
- fetchItems: jest.fn(),
- };
keyPairsActions = {
fetchItems: jest.fn(),
};
@@ -72,10 +67,6 @@ describe('EksClusterConfigurationForm', () => {
...clusterDropdownStoreState(),
...config.rolesState,
};
- regionsState = {
- ...clusterDropdownStoreState(),
- ...config.regionsState,
- };
vpcsState = {
...clusterDropdownStoreState(),
...config.vpcsState,
@@ -109,11 +100,6 @@ describe('EksClusterConfigurationForm', () => {
state: vpcsState,
actions: vpcsActions,
},
- regions: {
- namespaced: true,
- state: regionsState,
- actions: regionsActions,
- },
subnets: {
namespaced: true,
state: subnetsState,
@@ -189,7 +175,6 @@ describe('EksClusterConfigurationForm', () => {
const findClusterNameInput = () => vm.find('[id=eks-cluster-name]');
const findEnvironmentScopeInput = () => vm.find('[id=eks-environment-scope]');
const findKubernetesVersionDropdown = () => vm.find('[field-id="eks-kubernetes-version"]');
- const findRegionDropdown = () => vm.find('[field-id="eks-region"]');
const findKeyPairDropdown = () => vm.find('[field-id="eks-key-pair"]');
const findVpcDropdown = () => vm.find('[field-id="eks-vpc"]');
const findSubnetDropdown = () => vm.find('[field-id="eks-subnet"]');
@@ -200,13 +185,44 @@ describe('EksClusterConfigurationForm', () => {
const findGitlabManagedClusterCheckbox = () => vm.find(GlFormCheckbox);
describe('when mounted', () => {
- it('fetches available regions', () => {
- expect(regionsActions.fetchItems).toHaveBeenCalled();
- });
-
it('fetches available roles', () => {
expect(rolesActions.fetchItems).toHaveBeenCalled();
});
+
+ describe('when fetching vpcs and key pairs', () => {
+ const region = 'us-west-2';
+
+ beforeEach(() => {
+ createValidStateStore({ selectedRegion: region });
+ buildWrapper();
+ });
+
+ it('fetches available vpcs', () => {
+ expect(vpcsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), { region });
+ });
+
+ it('fetches available key pairs', () => {
+ expect(keyPairsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), { region });
+ });
+
+ it('cleans selected vpc', () => {
+ expect(actions.setVpc).toHaveBeenCalledWith(expect.anything(), { vpc: null });
+ });
+
+ it('cleans selected key pair', () => {
+ expect(actions.setKeyPair).toHaveBeenCalledWith(expect.anything(), { keyPair: null });
+ });
+
+ it('cleans selected subnet', () => {
+ expect(actions.setSubnet).toHaveBeenCalledWith(expect.anything(), { subnet: [] });
+ });
+
+ it('cleans selected security group', () => {
+ expect(actions.setSecurityGroup).toHaveBeenCalledWith(expect.anything(), {
+ securityGroup: null,
+ });
+ });
+ });
});
it('sets isLoadingRoles to RoleDropdown loading property', () => {
@@ -229,26 +245,6 @@ describe('EksClusterConfigurationForm', () => {
});
});
- it('sets isLoadingRegions to RegionDropdown loading property', () => {
- regionsState.isLoadingItems = true;
-
- return Vue.nextTick().then(() => {
- expect(findRegionDropdown().props('loading')).toBe(regionsState.isLoadingItems);
- });
- });
-
- it('sets regions to RegionDropdown regions property', () => {
- expect(findRegionDropdown().props('items')).toBe(regionsState.items);
- });
-
- it('sets loadingRegionsError to RegionDropdown error property', () => {
- regionsState.loadingItemsError = new Error();
-
- return Vue.nextTick().then(() => {
- expect(findRegionDropdown().props('hasErrors')).toEqual(true);
- });
- });
-
it('disables KeyPairDropdown when no region is selected', () => {
expect(findKeyPairDropdown().props('disabled')).toBe(true);
});
@@ -394,44 +390,6 @@ describe('EksClusterConfigurationForm', () => {
});
});
- describe('when region is selected', () => {
- const region = { name: 'us-west-2' };
-
- beforeEach(() => {
- findRegionDropdown().vm.$emit('input', region);
- });
-
- it('dispatches setRegion action', () => {
- expect(actions.setRegion).toHaveBeenCalledWith(expect.anything(), { region });
- });
-
- it('fetches available vpcs', () => {
- expect(vpcsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), { region });
- });
-
- it('fetches available key pairs', () => {
- expect(keyPairsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), { region });
- });
-
- it('cleans selected vpc', () => {
- expect(actions.setVpc).toHaveBeenCalledWith(expect.anything(), { vpc: null });
- });
-
- it('cleans selected key pair', () => {
- expect(actions.setKeyPair).toHaveBeenCalledWith(expect.anything(), { keyPair: null });
- });
-
- it('cleans selected subnet', () => {
- expect(actions.setSubnet).toHaveBeenCalledWith(expect.anything(), { subnet: [] });
- });
-
- it('cleans selected security group', () => {
- expect(actions.setSecurityGroup).toHaveBeenCalledWith(expect.anything(), {
- securityGroup: null,
- });
- });
- });
-
it('dispatches setClusterName when cluster name input changes', () => {
const clusterName = 'name';