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
8b2aa804
Commit
8b2aa804
authored
Feb 17, 2020
by
Ezekiel Kigbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace hardcoded status codes
parent
51e7b955
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
.../frontend/analytics/cycle_analytics/store/actions_spec.js
+21
-14
No files found.
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
View file @
8b2aa804
...
...
@@ -6,6 +6,7 @@ import * as actions from 'ee/analytics/cycle_analytics/store/actions';
import
*
as
types
from
'
ee/analytics/cycle_analytics/store/mutation_types
'
;
import
{
TASKS_BY_TYPE_FILTERS
}
from
'
ee/analytics/cycle_analytics/constants
'
;
import
createFlash
from
'
~/flash
'
;
import
httpStatusCodes
from
'
~/lib/utils/http_status
'
;
import
{
group
,
summaryData
,
...
...
@@ -21,7 +22,7 @@ import {
}
from
'
../mock_data
'
;
const
stageData
=
{
events
:
[]
};
const
error
=
new
Error
(
'
Request failed with status code 404
'
);
const
error
=
new
Error
(
`Request failed with status code
${
httpStatusCodes
.
NOT_FOUND
}
`
);
const
flashErrorMessage
=
'
There was an error while fetching value stream analytics data.
'
;
const
selectedGroup
=
{
fullPath
:
group
.
path
};
const
[
selectedStage
]
=
stages
;
...
...
@@ -125,7 +126,7 @@ describe('Cycle analytics actions', () => {
describe
(
'
with a failing request
'
,
()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
(
endpoints
.
stageData
).
replyOnce
(
404
,
{
error
});
mock
.
onGet
(
endpoints
.
stageData
).
replyOnce
(
httpStatusCodes
.
NOT_FOUND
,
{
error
});
});
it
(
'
dispatches receiveStageDataError on error
'
,
done
=>
{
...
...
@@ -620,7 +621,7 @@ describe('Cycle analytics actions', () => {
beforeEach
(()
=>
{
setFixtures
(
'
<div class="flash-container"></div>
'
);
mock
=
new
MockAdapter
(
axios
);
mock
.
onPut
(
stageEndpoint
({
stageId
})).
replyOnce
(
404
);
mock
.
onPut
(
stageEndpoint
({
stageId
})).
replyOnce
(
httpStatusCodes
.
NOT_FOUND
);
});
it
(
'
dispatches receiveUpdateStageError
'
,
done
=>
{
...
...
@@ -639,7 +640,7 @@ describe('Cycle analytics actions', () => {
{
type
:
'
receiveUpdateStageError
'
,
payload
:
{
status
:
404
,
status
:
httpStatusCodes
.
NOT_FOUND
,
data
,
},
},
...
...
@@ -655,7 +656,7 @@ describe('Cycle analytics actions', () => {
state
,
},
{
status
:
422
,
status
:
httpStatusCodes
.
UNPROCESSABLE_ENTITY
,
responseData
:
{
errors
:
{
name
:
[
'
is reserved
'
]
},
},
...
...
@@ -675,7 +676,7 @@ describe('Cycle analytics actions', () => {
commit
:
()
=>
{},
state
,
},
{
status
:
400
},
{
status
:
httpStatusCodes
.
BAD_REQUEST
},
);
shouldFlashAMessage
(
'
There was a problem saving your custom stage, please try again
'
);
...
...
@@ -759,7 +760,7 @@ describe('Cycle analytics actions', () => {
describe
(
'
with a failed request
'
,
()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
.
onDelete
(
stageEndpoint
({
stageId
})).
replyOnce
(
404
);
mock
.
onDelete
(
stageEndpoint
({
stageId
})).
replyOnce
(
httpStatusCodes
.
NOT_FOUND
);
});
it
(
'
dispatches receiveRemoveStageError
'
,
done
=>
{
...
...
@@ -1236,7 +1237,7 @@ describe('Cycle analytics actions', () => {
describe
(
'
with a failing request
'
,
()
=>
{
beforeEach
(()
=>
{
mock
.
onGet
(
endpoints
.
stageMedian
).
reply
(
404
,
{
error
});
mock
.
onGet
(
endpoints
.
stageMedian
).
reply
(
httpStatusCodes
.
NOT_FOUND
,
{
error
});
});
it
(
'
will dispatch receiveStageMedianValuesError
'
,
done
=>
{
...
...
@@ -1366,10 +1367,12 @@ describe('Cycle analytics actions', () => {
beforeEach
(()
=>
{
state
=
{
...
state
,
selectedGroup
};
mock
.
onPost
(
endpoints
.
baseStagesEndpointstageData
).
reply
(
422
,
{
message
,
errors
,
});
mock
.
onPost
(
endpoints
.
baseStagesEndpointstageData
)
.
reply
(
httpStatusCodes
.
UNPROCESSABLE_ENTITY
,
{
message
,
errors
,
});
});
it
(
`dispatches the 'receiveCreateCustomStageError' action`
,
()
=>
...
...
@@ -1386,7 +1389,7 @@ describe('Cycle analytics actions', () => {
data
:
customStageData
,
errors
,
message
,
status
:
422
,
status
:
httpStatusCodes
.
UNPROCESSABLE_ENTITY
,
},
},
],
...
...
@@ -1426,7 +1429,11 @@ describe('Cycle analytics actions', () => {
{
commit
:
()
=>
{},
},
{
...
response
,
status
:
422
,
errors
:
{
name
:
[
'
is reserved
'
]
}
},
{
...
response
,
status
:
httpStatusCodes
.
UNPROCESSABLE_ENTITY
,
errors
:
{
name
:
[
'
is reserved
'
]
},
},
);
shouldFlashAMessage
(
"
'uh oh' stage already exists
"
);
...
...
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