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
Léo-Paul Géneau
gitlab-ce
Commits
94981308
Commit
94981308
authored
Aug 03, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds action spec to cover 204
parent
15511ed1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
app/assets/javascripts/reports/store/actions.js
app/assets/javascripts/reports/store/actions.js
+4
-2
spec/javascripts/reports/store/actions_spec.js
spec/javascripts/reports/store/actions_spec.js
+17
-5
No files found.
app/assets/javascripts/reports/store/actions.js
View file @
94981308
...
...
@@ -43,7 +43,9 @@ export const fetchReports = ({ state, dispatch }) => {
},
data
:
state
.
endpoint
,
method
:
'
getReports
'
,
successCallback
:
(
response
)
=>
dispatch
(
'
receiveReportsSuccess
'
,
response
),
successCallback
:
({
data
,
status
})
=>
dispatch
(
'
receiveReportsSuccess
'
,
{
data
,
status
,
}),
errorCallback
:
()
=>
dispatch
(
'
receiveReportsError
'
),
});
...
...
@@ -52,7 +54,7 @@ export const fetchReports = ({ state, dispatch }) => {
}
else
{
axios
.
get
(
state
.
endpoint
)
.
then
((
response
)
=>
dispatch
(
'
receiveReportsSuccess
'
,
response
))
.
then
((
{
data
,
status
})
=>
dispatch
(
'
receiveReportsSuccess
'
,
{
data
,
status
}
))
.
catch
(()
=>
dispatch
(
'
receiveReportsError
'
));
}
...
...
spec/javascripts/reports/store/actions_spec.js
View file @
94981308
...
...
@@ -58,7 +58,9 @@ describe('Reports Store Actions', () => {
describe
(
'
success
'
,
()
=>
{
it
(
'
dispatches requestReports and receiveReportsSuccess
'
,
done
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
).
replyOnce
(
200
,
{
summary
:
{},
suites
:
[{
name
:
'
rspec
'
}]
});
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
)
.
replyOnce
(
200
,
{
summary
:
{},
suites
:
[{
name
:
'
rspec
'
}]
});
testAction
(
fetchReports
,
...
...
@@ -70,7 +72,7 @@ describe('Reports Store Actions', () => {
type
:
'
requestReports
'
,
},
{
payload
:
{
summary
:
{},
suites
:
[{
name
:
'
rspec
'
}]
},
payload
:
{
data
:
{
summary
:
{},
suites
:
[{
name
:
'
rspec
'
}]
},
status
:
200
},
type
:
'
receiveReportsSuccess
'
,
},
],
...
...
@@ -105,16 +107,27 @@ describe('Reports Store Actions', () => {
});
describe
(
'
receiveReportsSuccess
'
,
()
=>
{
it
(
'
should commit RECEIVE_REPORTS_SUCCESS mutation
'
,
done
=>
{
it
(
'
should commit RECEIVE_REPORTS_SUCCESS mutation
with 200
'
,
done
=>
{
testAction
(
receiveReportsSuccess
,
{
summary
:
{}
},
{
data
:
{
summary
:
{}
},
status
:
200
},
mockedState
,
[{
type
:
types
.
RECEIVE_REPORTS_SUCCESS
,
payload
:
{
summary
:
{}
}
}],
[],
done
,
);
});
it
(
'
should not commit RECEIVE_REPORTS_SUCCESS mutation with 204
'
,
done
=>
{
testAction
(
receiveReportsSuccess
,
{
data
:
{
summary
:
{}
},
status
:
204
},
mockedState
,
[],
[],
done
,
);
});
});
describe
(
'
receiveReportsError
'
,
()
=>
{
...
...
@@ -155,5 +168,4 @@ describe('Reports Store Actions', () => {
);
});
});
});
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