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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
d3ab245a
Commit
d3ab245a
authored
7 years ago
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds tests that were only in EE
parent
5e9f0bea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
21 deletions
+68
-21
spec/javascripts/environments/environments_store_spec.js
spec/javascripts/environments/environments_store_spec.js
+68
-21
No files found.
spec/javascripts/environments/environments_store_spec.js
View file @
d3ab245a
...
@@ -31,27 +31,49 @@ describe('Store', () => {
...
@@ -31,27 +31,49 @@ describe('Store', () => {
expect
(
store
.
state
.
stoppedCounter
).
toEqual
(
2
);
expect
(
store
.
state
.
stoppedCounter
).
toEqual
(
2
);
});
});
it
(
'
should store pagination information
'
,
()
=>
{
describe
(
'
store environments
'
,
()
=>
{
const
pagination
=
{
it
(
'
should store environments
'
,
()
=>
{
'
X-nExt-pAge
'
:
'
2
'
,
store
.
storeEnvironments
(
serverData
);
'
X-page
'
:
'
1
'
,
expect
(
store
.
state
.
environments
.
length
).
toEqual
(
serverData
.
length
);
'
X-Per-Page
'
:
'
1
'
,
});
'
X-Prev-Page
'
:
'
2
'
,
'
X-TOTAL
'
:
'
37
'
,
it
(
'
should add folder keys when environment is a folder
'
,
()
=>
{
'
X-Total-Pages
'
:
'
2
'
,
const
environment
=
{
};
name
:
'
bar
'
,
size
:
3
,
const
expectedResult
=
{
id
:
2
,
perPage
:
1
,
};
page
:
1
,
total
:
37
,
store
.
storeEnvironments
([
environment
]);
totalPages
:
2
,
expect
(
store
.
state
.
environments
[
0
].
isFolder
).
toEqual
(
true
);
nextPage
:
2
,
expect
(
store
.
state
.
environments
[
0
].
folderName
).
toEqual
(
'
bar
'
);
previousPage
:
2
,
});
};
it
(
'
should extract content of `latest` key when provided
'
,
()
=>
{
store
.
setPagination
(
pagination
);
const
environment
=
{
expect
(
store
.
state
.
paginationInformation
).
toEqual
(
expectedResult
);
name
:
'
bar
'
,
size
:
3
,
id
:
2
,
latest
:
{
last_deployment
:
{},
isStoppable
:
true
,
},
};
store
.
storeEnvironments
([
environment
]);
expect
(
store
.
state
.
environments
[
0
].
last_deployment
).
toEqual
({});
expect
(
store
.
state
.
environments
[
0
].
isStoppable
).
toEqual
(
true
);
});
it
(
'
should store latest.name when the environment is not a folder
'
,
()
=>
{
store
.
storeEnvironments
(
serverData
);
expect
(
store
.
state
.
environments
[
0
].
name
).
toEqual
(
serverData
[
0
].
latest
.
name
);
});
it
(
'
should store root level name when environment is a folder
'
,
()
=>
{
store
.
storeEnvironments
(
serverData
);
expect
(
store
.
state
.
environments
[
1
].
folderName
).
toEqual
(
serverData
[
1
].
name
);
});
});
});
describe
(
'
toggleFolder
'
,
()
=>
{
describe
(
'
toggleFolder
'
,
()
=>
{
...
@@ -76,4 +98,29 @@ describe('Store', () => {
...
@@ -76,4 +98,29 @@ describe('Store', () => {
expect
(
store
.
state
.
environments
[
1
].
children
[
0
].
isChildren
).
toEqual
(
true
);
expect
(
store
.
state
.
environments
[
1
].
children
[
0
].
isChildren
).
toEqual
(
true
);
});
});
});
});
describe
(
'
store pagination
'
,
()
=>
{
it
(
'
should store normalized and integer pagination information
'
,
()
=>
{
const
pagination
=
{
'
X-nExt-pAge
'
:
'
2
'
,
'
X-page
'
:
'
1
'
,
'
X-Per-Page
'
:
'
1
'
,
'
X-Prev-Page
'
:
'
2
'
,
'
X-TOTAL
'
:
'
37
'
,
'
X-Total-Pages
'
:
'
2
'
,
};
const
expectedResult
=
{
perPage
:
1
,
page
:
1
,
total
:
37
,
totalPages
:
2
,
nextPage
:
2
,
previousPage
:
2
,
};
store
.
setPagination
(
pagination
);
expect
(
store
.
state
.
paginationInformation
).
toEqual
(
expectedResult
);
});
});
});
});
This diff is collapsed.
Click to expand it.
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