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
c9afd7aa
Commit
c9afd7aa
authored
Mar 06, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci skip] Solve bad resolved conflict spec/javascripts/environments/environments_store_spec.js
parent
fa676b5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
27 deletions
+94
-27
spec/javascripts/environments/environments_store_spec.js
spec/javascripts/environments/environments_store_spec.js
+94
-27
No files found.
spec/javascripts/environments/environments_store_spec.js
View file @
c9afd7aa
const
Store
=
require
(
'
~/environments/stores/environments_store
'
);
const
{
environmentsList
,
server
Data
}
=
require
(
'
./mock_data
'
);
const
{
serverData
,
deployBoardMock
Data
}
=
require
(
'
./mock_data
'
);
(()
=>
{
describe
(
'
Store
'
,
()
=>
{
describe
(
'
Environments
Store
'
,
()
=>
{
let
store
;
beforeEach
(()
=>
{
...
...
@@ -16,10 +16,53 @@ const { environmentsList, serverData } = require('./mock_data');
expect
(
store
.
state
.
paginationInformation
).
toEqual
({});
});
it
(
'
should store environments
'
,
()
=>
{
store
.
storeEnvironments
(
serverData
);
expect
(
store
.
state
.
environments
.
length
).
toEqual
(
serverData
.
length
);
expect
(
store
.
state
.
environments
[
0
]).
toEqual
(
environmentsList
[
0
]);
describe
(
'
store environments
'
,
()
=>
{
it
(
'
should store environments
'
,
()
=>
{
store
.
storeEnvironments
(
serverData
);
expect
(
store
.
state
.
environments
.
length
).
toEqual
(
serverData
.
length
);
});
it
(
'
should store a non folder environment with deploy board if rollout_status_path key is provided
'
,
()
=>
{
const
environment
=
{
name
:
'
foo
'
,
size
:
1
,
id
:
1
,
rollout_status_path
:
'
url
'
,
};
store
.
storeEnvironments
([
environment
]);
expect
(
store
.
state
.
environments
[
0
].
hasDeployBoard
).
toEqual
(
true
);
expect
(
store
.
state
.
environments
[
0
].
isDeployBoardVisible
).
toEqual
(
false
);
expect
(
store
.
state
.
environments
[
0
].
deployBoardData
).
toEqual
({});
});
it
(
'
should add folder keys when environment is a folder
'
,
()
=>
{
const
environment
=
{
name
:
'
bar
'
,
size
:
3
,
id
:
2
,
};
store
.
storeEnvironments
([
environment
]);
expect
(
store
.
state
.
environments
[
0
].
isFolder
).
toEqual
(
true
);
expect
(
store
.
state
.
environments
[
0
].
folderName
).
toEqual
(
'
bar
'
);
});
it
(
'
should extract content of `latest` key when provided
'
,
()
=>
{
const
environment
=
{
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 available count
'
,
()
=>
{
...
...
@@ -32,27 +75,51 @@ const { environmentsList, serverData } = require('./mock_data');
expect
(
store
.
state
.
stoppedCounter
).
toEqual
(
2
);
});
it
(
'
should store 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
);
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
);
});
});
describe
(
'
deploy boards
'
,
()
=>
{
beforeEach
(()
=>
{
const
environment
=
{
name
:
'
foo
'
,
size
:
1
,
id
:
1
,
};
store
.
storeEnvironments
([
environment
]);
});
it
(
'
should toggle deploy board property for given environment id
'
,
()
=>
{
store
.
toggleDeployBoard
(
1
);
expect
(
store
.
state
.
environments
[
0
].
isDeployBoardVisible
).
toEqual
(
true
);
});
it
(
'
should store deploy board data for given environment id
'
,
()
=>
{
store
.
storeDeployBoard
(
1
,
deployBoardMockData
);
expect
(
store
.
state
.
environments
[
0
].
deployBoardData
).
toEqual
(
deployBoardMockData
);
});
});
});
})();
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