Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
303af892
Commit
303af892
authored
May 23, 2018
by
Dennis Tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update mutation spec to use real store
parent
b394cc31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
46 deletions
+26
-46
spec/javascripts/projects/gke_cluster_dropdowns/stores/mutations_spec.js
...s/projects/gke_cluster_dropdowns/stores/mutations_spec.js
+26
-46
No files found.
spec/javascripts/projects/gke_cluster_dropdowns/stores/mutations_spec.js
View file @
303af892
import
mutations
from
'
~/projects/gke_cluster_dropdowns/store/mutations
'
;
import
{
createStore
}
from
'
~/projects/gke_cluster_dropdowns/store
'
;
import
*
as
types
from
'
~/projects/gke_cluster_dropdowns/store/mutation_types
'
;
import
{
selectedProjectMock
,
selectedZoneMock
,
...
...
@@ -9,99 +10,78 @@ import {
}
from
'
../mock_data
'
;
describe
(
'
GCP Cluster Dropdown Store Mutations
'
,
()
=>
{
let
store
;
beforeEach
(()
=>
{
store
=
createStore
();
});
describe
(
'
SET_PROJECT
'
,
()
=>
{
it
(
'
should set GCP project as selectedProject
'
,
()
=>
{
const
state
=
{
selectedProject
:
{
projectId
:
''
,
name
:
''
,
},
};
const
projectToSelect
=
gapiProjectsResponseMock
.
projects
[
0
];
mutations
.
SET_PROJECT
(
state
,
projectToSelect
);
store
.
commit
(
types
.
SET_PROJECT
,
projectToSelect
);
expect
(
state
.
selectedProject
.
projectId
).
toEqual
(
selectedProjectMock
.
projectId
);
expect
(
state
.
selectedProject
.
name
).
toEqual
(
selectedProjectMock
.
name
);
expect
(
st
ore
.
st
ate
.
selectedProject
.
projectId
).
toEqual
(
selectedProjectMock
.
projectId
);
expect
(
st
ore
.
st
ate
.
selectedProject
.
name
).
toEqual
(
selectedProjectMock
.
name
);
});
});
describe
(
'
SET_PROJECT_BILLING_STATUS
'
,
()
=>
{
it
(
'
should set project billing status
'
,
()
=>
{
const
state
=
{
projectHasBillingEnabled
:
null
,
};
mutations
.
SET_PROJECT_BILLING_STATUS
(
state
,
true
);
store
.
commit
(
types
.
SET_PROJECT_BILLING_STATUS
,
true
);
expect
(
state
.
projectHasBillingEnabled
).
toBeTruthy
();
expect
(
st
ore
.
st
ate
.
projectHasBillingEnabled
).
toBeTruthy
();
});
});
describe
(
'
SET_ZONE
'
,
()
=>
{
it
(
'
should set GCP zone as selectedZone
'
,
()
=>
{
const
state
=
{
selectedZone
:
''
,
};
const
zoneToSelect
=
gapiZonesResponseMock
.
items
[
0
].
name
;
mutations
.
SET_ZONE
(
state
,
zoneToSelect
);
store
.
commit
(
types
.
SET_ZONE
,
zoneToSelect
);
expect
(
state
.
selectedZone
).
toEqual
(
selectedZoneMock
);
expect
(
st
ore
.
st
ate
.
selectedZone
).
toEqual
(
selectedZoneMock
);
});
});
describe
(
'
SET_MACHINE_TYPE
'
,
()
=>
{
it
(
'
should set GCP machine type as selectedMachineType
'
,
()
=>
{
const
state
=
{
selectedMachineType
:
''
,
};
const
machineTypeToSelect
=
gapiMachineTypesResponseMock
.
items
[
0
].
name
;
mutations
.
SET_MACHINE_TYPE
(
state
,
machineTypeToSelect
);
store
.
commit
(
types
.
SET_MACHINE_TYPE
,
machineTypeToSelect
);
expect
(
state
.
selectedMachineType
).
toEqual
(
selectedMachineTypeMock
);
expect
(
st
ore
.
st
ate
.
selectedMachineType
).
toEqual
(
selectedMachineTypeMock
);
});
});
describe
(
'
SET_PROJECTS
'
,
()
=>
{
it
(
'
should set Google API Projects response as projects
'
,
()
=>
{
const
state
=
{
projects
:
[],
};
expect
(
store
.
state
.
projects
.
length
).
toEqual
(
0
);
expect
(
state
.
projects
.
length
).
toEqual
(
0
);
store
.
commit
(
types
.
SET_PROJECTS
,
gapiProjectsResponseMock
.
projects
);
mutations
.
SET_PROJECTS
(
state
,
gapiProjectsResponseMock
.
projects
);
expect
(
state
.
projects
.
length
).
toEqual
(
gapiProjectsResponseMock
.
projects
.
length
);
expect
(
store
.
state
.
projects
.
length
).
toEqual
(
gapiProjectsResponseMock
.
projects
.
length
);
});
});
describe
(
'
SET_ZONES
'
,
()
=>
{
it
(
'
should set Google API Zones response as zones
'
,
()
=>
{
const
state
=
{
zones
:
[],
};
expect
(
state
.
zones
.
length
).
toEqual
(
0
);
expect
(
store
.
state
.
zones
.
length
).
toEqual
(
0
);
mutations
.
SET_ZONES
(
state
,
gapiZonesResponseMock
.
items
);
store
.
commit
(
types
.
SET_ZONES
,
gapiZonesResponseMock
.
items
);
expect
(
state
.
zones
.
length
).
toEqual
(
gapiZonesResponseMock
.
items
.
length
);
expect
(
st
ore
.
st
ate
.
zones
.
length
).
toEqual
(
gapiZonesResponseMock
.
items
.
length
);
});
});
describe
(
'
SET_MACHINE_TYPES
'
,
()
=>
{
it
(
'
should set Google API Machine Types response as machineTypes
'
,
()
=>
{
const
state
=
{
machineTypes
:
[],
};
expect
(
state
.
machineTypes
.
length
).
toEqual
(
0
);
expect
(
store
.
state
.
machineTypes
.
length
).
toEqual
(
0
);
mutations
.
SET_MACHINE_TYPES
(
state
,
gapiMachineTypesResponseMock
.
items
);
store
.
commit
(
types
.
SET_MACHINE_TYPES
,
gapiMachineTypesResponseMock
.
items
);
expect
(
state
.
machineTypes
.
length
).
toEqual
(
gapiMachineTypesResponseMock
.
items
.
length
);
expect
(
st
ore
.
st
ate
.
machineTypes
.
length
).
toEqual
(
gapiMachineTypesResponseMock
.
items
.
length
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment