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
fa8242cc
Commit
fa8242cc
authored
Feb 08, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'karma-fixes' into 'master'
Fixed geo_nodes karma spec See merge request gitlab-org/gitlab-ee!4444
parents
57a43be1
c3c7739a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
spec/javascripts/geo_nodes/components/app_spec.js
spec/javascripts/geo_nodes/components/app_spec.js
+17
-16
No files found.
spec/javascripts/geo_nodes/components/app_spec.js
View file @
fa8242cc
...
...
@@ -25,13 +25,23 @@ const createComponent = () => {
describe
(
'
AppComponent
'
,
()
=>
{
let
vm
;
let
mock
;
let
statusCode
;
let
response
;
beforeEach
(()
=>
{
statusCode
=
200
;
response
=
mockNodes
;
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
(
/
(
.*
)\/
geo_nodes$/
).
reply
(()
=>
[
statusCode
,
response
]);
vm
=
createComponent
();
});
afterEach
(()
=>
{
vm
.
$destroy
();
mock
.
restore
();
});
describe
(
'
data
'
,
()
=>
{
...
...
@@ -51,19 +61,8 @@ describe('AppComponent', () => {
});
describe
(
'
methods
'
,
()
=>
{
let
mock
;
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
});
afterEach
(()
=>
{
mock
.
restore
();
});
describe
(
'
fetchGeoNodes
'
,
()
=>
{
it
(
'
calls service.getGeoNodes and sets response to the store on success
'
,
(
done
)
=>
{
mock
.
onGet
(
vm
.
store
.
geoNodesPath
).
reply
(
200
,
mockNodes
);
spyOn
(
vm
.
store
,
'
setNodes
'
);
vm
.
fetchGeoNodes
();
...
...
@@ -76,14 +75,14 @@ describe('AppComponent', () => {
});
it
(
'
sets error flag and message on failure
'
,
(
done
)
=>
{
const
err
=
'
Something went wrong
'
;
mock
.
onGet
(
vm
.
store
.
geoNodesPath
).
reply
(
500
,
err
)
;
response
=
'
Something went wrong
'
;
statusCode
=
500
;
vm
.
fetchGeoNodes
();
expect
(
vm
.
hasError
).
toBeFalsy
();
setTimeout
(()
=>
{
expect
(
vm
.
hasError
).
toBeTruthy
();
expect
(
vm
.
errorMessage
.
response
.
data
).
toBe
(
err
);
expect
(
vm
.
errorMessage
.
response
.
data
).
toBe
(
response
);
done
();
},
0
);
});
...
...
@@ -92,11 +91,13 @@ describe('AppComponent', () => {
describe
(
'
fetchNodeDetails
'
,
()
=>
{
it
(
'
calls service.getGeoNodeDetails and sets response to the store on success
'
,
(
done
)
=>
{
mock
.
onGet
(
`
${
vm
.
service
.
geoNodeDetailsBasePath
}
/2/status.json`
).
reply
(
200
,
rawMockNodeDetails
);
spyOn
(
vm
.
s
tore
,
'
setNodeDetails
'
);
spyOn
(
vm
.
s
ervice
,
'
getGeoNodeDetails
'
).
and
.
callThrough
(
);
vm
.
fetchNodeDetails
(
2
);
setTimeout
(()
=>
{
expect
(
vm
.
store
.
setNodeDetails
).
toHaveBeenCalled
();
expect
(
vm
.
service
.
getGeoNodeDetails
).
toHaveBeenCalled
();
expect
(
Object
.
keys
(
vm
.
store
.
state
.
nodeDetails
).
length
).
toBe
(
1
);
expect
(
vm
.
store
.
state
.
nodeDetails
[
'
2
'
]).
toBeDefined
();
done
();
},
0
);
});
...
...
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