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
e2ae04a1
Commit
e2ae04a1
authored
Aug 02, 2021
by
Ezekiel Kigbo
Committed by
Martin Wortschack
Aug 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[VSA] Add missing vuex action specs
parent
a496b58e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
176 additions
and
35 deletions
+176
-35
app/assets/javascripts/cycle_analytics/constants.js
app/assets/javascripts/cycle_analytics/constants.js
+9
-1
app/assets/javascripts/cycle_analytics/store/actions.js
app/assets/javascripts/cycle_analytics/store/actions.js
+6
-4
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions/stages.js
...scripts/analytics/cycle_analytics/store/actions/stages.js
+8
-11
ee/spec/frontend/analytics/cycle_analytics/components/base_spec.js
...rontend/analytics/cycle_analytics/components/base_spec.js
+9
-10
ee/spec/frontend/analytics/cycle_analytics/store/actions/filters_spec.js
...d/analytics/cycle_analytics/store/actions/filters_spec.js
+15
-0
ee/spec/frontend/analytics/cycle_analytics/store/actions/stages_spec.js
...nd/analytics/cycle_analytics/store/actions/stages_spec.js
+108
-5
ee/spec/frontend/analytics/cycle_analytics/store/actions/value_streams_spec.js
...ytics/cycle_analytics/store/actions/value_streams_spec.js
+18
-0
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
.../frontend/analytics/cycle_analytics/store/actions_spec.js
+3
-4
No files found.
app/assets/javascripts/cycle_analytics/constants.js
View file @
e2ae04a1
import
{
s__
}
from
'
~/locale
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
export
const
DEFAULT_DAYS_IN_PAST
=
30
;
export
const
DEFAULT_DAYS_IN_PAST
=
30
;
export
const
DEFAULT_DAYS_TO_DISPLAY
=
30
;
export
const
DEFAULT_DAYS_TO_DISPLAY
=
30
;
...
@@ -22,3 +22,11 @@ export const PAGINATION_SORT_DIRECTION_ASC = 'asc';
...
@@ -22,3 +22,11 @@ export const PAGINATION_SORT_DIRECTION_ASC = 'asc';
export
const
STAGE_TITLE_STAGING
=
'
staging
'
;
export
const
STAGE_TITLE_STAGING
=
'
staging
'
;
export
const
STAGE_TITLE_TEST
=
'
test
'
;
export
const
STAGE_TITLE_TEST
=
'
test
'
;
export
const
I18N_VSA_ERROR_STAGES
=
__
(
'
There was an error fetching value stream analytics stages.
'
,
);
export
const
I18N_VSA_ERROR_STAGE_MEDIAN
=
__
(
'
There was an error fetching median data for stages
'
);
export
const
I18N_VSA_ERROR_SELECTED_STAGE
=
__
(
'
There was an error fetching data for the selected stage
'
,
);
app/assets/javascripts/cycle_analytics/store/actions.js
View file @
e2ae04a1
...
@@ -7,7 +7,11 @@ import {
...
@@ -7,7 +7,11 @@ import {
}
from
'
~/api/analytics_api
'
;
}
from
'
~/api/analytics_api
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
DEFAULT_DAYS_TO_DISPLAY
,
DEFAULT_VALUE_STREAM
}
from
'
../constants
'
;
import
{
DEFAULT_DAYS_TO_DISPLAY
,
DEFAULT_VALUE_STREAM
,
I18N_VSA_ERROR_STAGE_MEDIAN
,
}
from
'
../constants
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
types
from
'
./mutation_types
'
;
export
const
setSelectedValueStream
=
({
commit
,
dispatch
},
valueStream
)
=>
{
export
const
setSelectedValueStream
=
({
commit
,
dispatch
},
valueStream
)
=>
{
...
@@ -120,9 +124,7 @@ export const fetchStageMedians = ({
...
@@ -120,9 +124,7 @@ export const fetchStageMedians = ({
.
then
((
data
)
=>
commit
(
types
.
RECEIVE_STAGE_MEDIANS_SUCCESS
,
data
))
.
then
((
data
)
=>
commit
(
types
.
RECEIVE_STAGE_MEDIANS_SUCCESS
,
data
))
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
commit
(
types
.
RECEIVE_STAGE_MEDIANS_ERROR
,
error
);
commit
(
types
.
RECEIVE_STAGE_MEDIANS_ERROR
,
error
);
createFlash
({
createFlash
({
message
:
I18N_VSA_ERROR_STAGE_MEDIAN
});
message
:
__
(
'
There was an error fetching median data for stages
'
),
});
});
});
};
};
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions/stages.js
View file @
e2ae04a1
import
Api
from
'
ee/api
'
;
import
Api
from
'
ee/api
'
;
import
{
getValueStreamStageMedian
}
from
'
~/api/analytics_api
'
;
import
{
getValueStreamStageMedian
}
from
'
~/api/analytics_api
'
;
import
{
I18N_VSA_ERROR_STAGES
,
I18N_VSA_ERROR_STAGE_MEDIAN
,
I18N_VSA_ERROR_SELECTED_STAGE
,
}
from
'
~/cycle_analytics/constants
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
normalizeHeaders
,
parseIntPagination
}
from
'
~/lib/utils/common_utils
'
;
import
{
normalizeHeaders
,
parseIntPagination
}
from
'
~/lib/utils/common_utils
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
OVERVIEW_STAGE_CONFIG
}
from
'
../../constants
'
;
import
{
OVERVIEW_STAGE_CONFIG
}
from
'
../../constants
'
;
import
{
checkForDataError
,
flashErrorIfStatusNotOk
,
throwIfUserForbidden
}
from
'
../../utils
'
;
import
{
checkForDataError
,
flashErrorIfStatusNotOk
,
throwIfUserForbidden
}
from
'
../../utils
'
;
import
*
as
types
from
'
../mutation_types
'
;
import
*
as
types
from
'
../mutation_types
'
;
...
@@ -16,10 +20,7 @@ export const requestStageData = ({ commit }) => commit(types.REQUEST_STAGE_DATA)
...
@@ -16,10 +20,7 @@ export const requestStageData = ({ commit }) => commit(types.REQUEST_STAGE_DATA)
export
const
receiveStageDataError
=
({
commit
},
error
)
=>
{
export
const
receiveStageDataError
=
({
commit
},
error
)
=>
{
const
{
message
=
''
}
=
error
;
const
{
message
=
''
}
=
error
;
flashErrorIfStatusNotOk
({
flashErrorIfStatusNotOk
({
error
,
message
:
I18N_VSA_ERROR_SELECTED_STAGE
});
error
,
message
:
__
(
'
There was an error fetching data for the selected stage
'
),
});
commit
(
types
.
RECEIVE_STAGE_DATA_ERROR
,
message
);
commit
(
types
.
RECEIVE_STAGE_DATA_ERROR
,
message
);
};
};
...
@@ -54,9 +55,7 @@ export const requestStageMedianValues = ({ commit }) => commit(types.REQUEST_STA
...
@@ -54,9 +55,7 @@ export const requestStageMedianValues = ({ commit }) => commit(types.REQUEST_STA
export
const
receiveStageMedianValuesError
=
({
commit
},
error
)
=>
{
export
const
receiveStageMedianValuesError
=
({
commit
},
error
)
=>
{
commit
(
types
.
RECEIVE_STAGE_MEDIANS_ERROR
,
error
);
commit
(
types
.
RECEIVE_STAGE_MEDIANS_ERROR
,
error
);
createFlash
({
createFlash
({
message
:
I18N_VSA_ERROR_STAGE_MEDIAN
});
message
:
__
(
'
There was an error fetching median data for stages
'
),
});
};
};
const
fetchStageMedian
=
({
groupId
,
valueStreamId
,
stageId
,
params
})
=>
const
fetchStageMedian
=
({
groupId
,
valueStreamId
,
stageId
,
params
})
=>
...
@@ -137,9 +136,7 @@ export const requestGroupStages = ({ commit }) => commit(types.REQUEST_GROUP_STA
...
@@ -137,9 +136,7 @@ export const requestGroupStages = ({ commit }) => commit(types.REQUEST_GROUP_STA
export
const
receiveGroupStagesError
=
({
commit
},
error
)
=>
{
export
const
receiveGroupStagesError
=
({
commit
},
error
)
=>
{
commit
(
types
.
RECEIVE_GROUP_STAGES_ERROR
,
error
);
commit
(
types
.
RECEIVE_GROUP_STAGES_ERROR
,
error
);
createFlash
({
createFlash
({
message
:
I18N_VSA_ERROR_STAGES
});
message
:
__
(
'
There was an error fetching value stream analytics stages.
'
),
});
};
};
export
const
receiveGroupStagesSuccess
=
({
commit
},
stages
)
=>
export
const
receiveGroupStagesSuccess
=
({
commit
},
stages
)
=>
...
...
ee/spec/frontend/analytics/cycle_analytics/components/base_spec.js
View file @
e2ae04a1
...
@@ -20,7 +20,12 @@ import {
...
@@ -20,7 +20,12 @@ import {
import
PathNavigation
from
'
~/cycle_analytics/components/path_navigation.vue
'
;
import
PathNavigation
from
'
~/cycle_analytics/components/path_navigation.vue
'
;
import
StageTable
from
'
~/cycle_analytics/components/stage_table.vue
'
;
import
StageTable
from
'
~/cycle_analytics/components/stage_table.vue
'
;
import
ValueStreamFilters
from
'
~/cycle_analytics/components/value_stream_filters.vue
'
;
import
ValueStreamFilters
from
'
~/cycle_analytics/components/value_stream_filters.vue
'
;
import
{
OVERVIEW_STAGE_ID
}
from
'
~/cycle_analytics/constants
'
;
import
{
OVERVIEW_STAGE_ID
,
I18N_VSA_ERROR_STAGES
,
I18N_VSA_ERROR_STAGE_MEDIAN
,
I18N_VSA_ERROR_SELECTED_STAGE
,
}
from
'
~/cycle_analytics/constants
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
*
as
commonUtils
from
'
~/lib/utils/common_utils
'
;
import
*
as
commonUtils
from
'
~/lib/utils/common_utils
'
;
...
@@ -343,9 +348,7 @@ describe('EE Value Stream Analytics component', () => {
...
@@ -343,9 +348,7 @@ describe('EE Value Stream Analytics component', () => {
.
reply
(
httpStatusCodes
.
NOT_FOUND
,
{
response
:
{
status
:
httpStatusCodes
.
NOT_FOUND
}
});
.
reply
(
httpStatusCodes
.
NOT_FOUND
,
{
response
:
{
status
:
httpStatusCodes
.
NOT_FOUND
}
});
wrapper
=
await
createComponent
();
wrapper
=
await
createComponent
();
expect
(
createFlash
).
toHaveBeenCalledWith
({
expect
(
createFlash
).
toHaveBeenCalledWith
({
message
:
I18N_VSA_ERROR_STAGES
});
message
:
'
There was an error fetching value stream analytics stages.
'
,
});
});
});
it
(
'
will display an error if the fetchStageData request fails
'
,
async
()
=>
{
it
(
'
will display an error if the fetchStageData request fails
'
,
async
()
=>
{
...
@@ -357,9 +360,7 @@ describe('EE Value Stream Analytics component', () => {
...
@@ -357,9 +360,7 @@ describe('EE Value Stream Analytics component', () => {
wrapper
=
await
createComponent
({
selectedStage
:
issueStage
});
wrapper
=
await
createComponent
({
selectedStage
:
issueStage
});
expect
(
createFlash
).
toHaveBeenCalledWith
({
expect
(
createFlash
).
toHaveBeenCalledWith
({
message
:
I18N_VSA_ERROR_SELECTED_STAGE
});
message
:
'
There was an error fetching data for the selected stage
'
,
});
});
});
it
(
'
will display an error if the fetchTopRankedGroupLabels request fails
'
,
async
()
=>
{
it
(
'
will display an error if the fetchTopRankedGroupLabels request fails
'
,
async
()
=>
{
...
@@ -398,9 +399,7 @@ describe('EE Value Stream Analytics component', () => {
...
@@ -398,9 +399,7 @@ describe('EE Value Stream Analytics component', () => {
.
reply
(
httpStatusCodes
.
NOT_FOUND
,
{
response
:
{
status
:
httpStatusCodes
.
NOT_FOUND
}
});
.
reply
(
httpStatusCodes
.
NOT_FOUND
,
{
response
:
{
status
:
httpStatusCodes
.
NOT_FOUND
}
});
wrapper
=
await
createComponent
();
wrapper
=
await
createComponent
();
expect
(
createFlash
).
toHaveBeenCalledWith
({
expect
(
createFlash
).
toHaveBeenCalledWith
({
message
:
I18N_VSA_ERROR_STAGE_MEDIAN
});
message
:
'
There was an error fetching median data for stages
'
,
});
});
});
it
(
'
will display an error if the fetchStageData request is successful but has an embedded error
'
,
async
()
=>
{
it
(
'
will display an error if the fetchStageData request is successful but has an embedded error
'
,
async
()
=>
{
...
...
ee/spec/frontend/analytics/cycle_analytics/store/actions/filters_spec.js
View file @
e2ae04a1
...
@@ -78,4 +78,19 @@ describe('Value Stream Analytics actions / filters', () => {
...
@@ -78,4 +78,19 @@ describe('Value Stream Analytics actions / filters', () => {
});
});
});
});
});
});
describe
(
'
updateStageTablePagination
'
,
()
=>
{
beforeEach
(()
=>
{
state
=
{
...
state
,
selectedStage
};
});
it
(
`will dispatch the "fetchStageData" action and commit the
${
types
.
SET_PAGINATION
}
mutation`
,
()
=>
{
return
testAction
({
action
:
actions
.
updateStageTablePagination
,
state
,
expectedMutations
:
[{
type
:
types
.
SET_PAGINATION
}],
expectedActions
:
[{
type
:
'
fetchStageData
'
,
payload
:
selectedStage
.
id
}],
});
});
});
});
});
ee/spec/frontend/analytics/cycle_analytics/store/actions/stages_spec.js
View file @
e2ae04a1
...
@@ -6,6 +6,11 @@ import * as getters from 'ee/analytics/cycle_analytics/store/getters';
...
@@ -6,6 +6,11 @@ import * as getters from 'ee/analytics/cycle_analytics/store/getters';
import
*
as
types
from
'
ee/analytics/cycle_analytics/store/mutation_types
'
;
import
*
as
types
from
'
ee/analytics/cycle_analytics/store/mutation_types
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
{
createdAfter
,
createdBefore
,
currentGroup
}
from
'
jest/cycle_analytics/mock_data
'
;
import
{
createdAfter
,
createdBefore
,
currentGroup
}
from
'
jest/cycle_analytics/mock_data
'
;
import
{
I18N_VSA_ERROR_STAGES
,
I18N_VSA_ERROR_STAGE_MEDIAN
,
I18N_VSA_ERROR_SELECTED_STAGE
,
}
from
'
~/cycle_analytics/constants
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
httpStatusCodes
from
'
~/lib/utils/http_status
'
;
import
httpStatusCodes
from
'
~/lib/utils/http_status
'
;
import
{
import
{
...
@@ -26,9 +31,15 @@ const [selectedStage] = activeStages;
...
@@ -26,9 +31,15 @@ const [selectedStage] = activeStages;
const
selectedStageSlug
=
selectedStage
.
slug
;
const
selectedStageSlug
=
selectedStage
.
slug
;
const
[
selectedValueStream
]
=
valueStreams
;
const
[
selectedValueStream
]
=
valueStreams
;
const
selectedProjectIds
=
[
1
,
2
];
const
mockGetters
=
{
const
mockGetters
=
{
currentGroupPath
:
()
=>
currentGroup
.
fullPath
,
currentGroupPath
:
()
=>
currentGroup
.
fullPath
,
currentValueStreamId
:
()
=>
selectedValueStream
.
id
,
currentValueStreamId
:
()
=>
selectedValueStream
.
id
,
cycleAnalyticsRequestParams
:
()
=>
({
created_after
:
createdAfter
,
project_ids
:
selectedProjectIds
,
}),
};
};
jest
.
mock
(
'
~/flash
'
);
jest
.
mock
(
'
~/flash
'
);
...
@@ -77,6 +88,15 @@ describe('Value Stream Analytics actions / stages', () => {
...
@@ -77,6 +88,15 @@ describe('Value Stream Analytics actions / stages', () => {
});
});
});
});
describe
(
'
requestStageData
'
,
()
=>
{
it
(
`commits the
${
types
.
REQUEST_STAGE_DATA
}
mutation`
,
()
=>
{
return
testAction
({
action
:
actions
.
requestStageData
,
expectedMutations
:
[{
type
:
types
.
REQUEST_STAGE_DATA
}],
});
});
});
describe
(
'
fetchStageData
'
,
()
=>
{
describe
(
'
fetchStageData
'
,
()
=>
{
const
headers
=
{
const
headers
=
{
'
X-Next-Page
'
:
2
,
'
X-Next-Page
'
:
2
,
...
@@ -182,8 +202,15 @@ describe('Value Stream Analytics actions / stages', () => {
...
@@ -182,8 +202,15 @@ describe('Value Stream Analytics actions / stages', () => {
it
(
'
will flash an error message
'
,
()
=>
{
it
(
'
will flash an error message
'
,
()
=>
{
actions
.
receiveStageDataError
({
commit
:
()
=>
{}
},
{});
actions
.
receiveStageDataError
({
commit
:
()
=>
{}
},
{});
expect
(
createFlash
).
toHaveBeenCalledWith
({
expect
(
createFlash
).
toHaveBeenCalledWith
({
message
:
I18N_VSA_ERROR_SELECTED_STAGE
});
message
:
'
There was an error fetching data for the selected stage
'
,
});
});
describe
(
'
requestStageMedianValues
'
,
()
=>
{
it
(
`commits the
${
types
.
REQUEST_STAGE_MEDIANS
}
mutation`
,
()
=>
{
return
testAction
({
action
:
actions
.
requestStageMedianValues
,
expectedMutations
:
[{
type
:
types
.
REQUEST_STAGE_MEDIANS
}],
});
});
});
});
});
});
...
@@ -284,9 +311,7 @@ describe('Value Stream Analytics actions / stages', () => {
...
@@ -284,9 +311,7 @@ describe('Value Stream Analytics actions / stages', () => {
it
(
'
will flash an error message
'
,
()
=>
{
it
(
'
will flash an error message
'
,
()
=>
{
actions
.
receiveStageMedianValuesError
({
commit
:
()
=>
{}
});
actions
.
receiveStageMedianValuesError
({
commit
:
()
=>
{}
});
expect
(
createFlash
).
toHaveBeenCalledWith
({
expect
(
createFlash
).
toHaveBeenCalledWith
({
message
:
I18N_VSA_ERROR_STAGE_MEDIAN
});
message
:
'
There was an error fetching median data for stages
'
,
});
});
});
});
});
...
@@ -318,6 +343,32 @@ describe('Value Stream Analytics actions / stages', () => {
...
@@ -318,6 +343,32 @@ describe('Value Stream Analytics actions / stages', () => {
});
});
});
});
describe
(
'
requestGroupStages
'
,
()
=>
{
it
(
`commits the
${
types
.
REQUEST_GROUP_STAGES
}
mutation`
,
()
=>
{
return
testAction
({
action
:
actions
.
requestGroupStages
,
expectedMutations
:
[{
type
:
types
.
REQUEST_GROUP_STAGES
}],
});
});
});
describe
(
'
receiveGroupStagesError
'
,
()
=>
{
it
(
`commits the
${
types
.
RECEIVE_GROUP_STAGES_ERROR
}
mutation`
,
()
=>
{
return
testAction
({
action
:
actions
.
receiveGroupStagesError
,
expectedMutations
:
[{
type
:
types
.
RECEIVE_GROUP_STAGES_ERROR
}],
});
});
it
(
'
will flash an error message
'
,
async
()
=>
{
expect
(
createFlash
).
not
.
toHaveBeenCalled
();
await
actions
.
receiveGroupStagesError
({
commit
:
()
=>
{}
});
expect
(
createFlash
).
toHaveBeenCalledWith
({
message
:
I18N_VSA_ERROR_STAGES
});
});
});
describe
(
'
receiveGroupStagesSuccess
'
,
()
=>
{
describe
(
'
receiveGroupStagesSuccess
'
,
()
=>
{
it
(
`commits the
${
types
.
RECEIVE_GROUP_STAGES_SUCCESS
}
mutation'`
,
()
=>
{
it
(
`commits the
${
types
.
RECEIVE_GROUP_STAGES_SUCCESS
}
mutation'`
,
()
=>
{
return
testAction
(
return
testAction
(
...
@@ -334,4 +385,56 @@ describe('Value Stream Analytics actions / stages', () => {
...
@@ -334,4 +385,56 @@ describe('Value Stream Analytics actions / stages', () => {
);
);
});
});
});
});
describe
(
'
fetchGroupStagesAndEvents
'
,
()
=>
{
const
{
stages
:
groupStages
,
events
}
=
customizableStagesAndEvents
;
beforeEach
(()
=>
{
state
=
{
...
state
,
...
mockGetters
};
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
(
endpoints
.
baseStagesEndpoint
)
.
reply
(
httpStatusCodes
.
OK
,
customizableStagesAndEvents
);
});
it
(
`commits
${
types
.
RECEIVE_STAGE_DATA_SUCCESS
}
with received data and headers on success`
,
()
=>
{
return
testAction
({
action
:
actions
.
fetchGroupStagesAndEvents
,
state
,
expectedMutations
:
[
{
type
:
types
.
SET_STAGE_EVENTS
,
payload
:
[]
},
{
type
:
types
.
SET_STAGE_EVENTS
,
payload
:
events
,
},
],
expectedActions
:
[
{
type
:
'
requestGroupStages
'
},
{
type
:
'
receiveGroupStagesSuccess
'
,
payload
:
groupStages
},
],
});
});
describe
(
'
with a failing request
'
,
()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
(
endpoints
.
baseStagesEndpoint
).
replyOnce
(
httpStatusCodes
.
NOT_FOUND
,
{
error
});
});
it
(
'
dispatches receiveGroupStagesError on error
'
,
()
=>
{
return
testAction
({
action
:
actions
.
fetchGroupStagesAndEvents
,
state
,
expectedMutations
:
[{
type
:
types
.
SET_STAGE_EVENTS
,
payload
:
[]
}],
expectedActions
:
[
{
type
:
'
requestGroupStages
'
},
{
type
:
'
receiveGroupStagesError
'
,
payload
:
error
,
},
],
});
});
});
});
});
});
ee/spec/frontend/analytics/cycle_analytics/store/actions/value_streams_spec.js
View file @
e2ae04a1
...
@@ -129,6 +129,24 @@ describe('Value Stream Analytics actions / value streams', () => {
...
@@ -129,6 +129,24 @@ describe('Value Stream Analytics actions / value streams', () => {
});
});
});
});
describe
(
'
receiveCreateValueStreamSuccess
'
,
()
=>
{
beforeEach
(()
=>
{
state
=
{
...
state
,
valueStream
:
{}
};
});
it
(
`will dispatch the "fetchCycleAnalyticsData" action and commit the
${
types
.
RECEIVE_CREATE_VALUE_STREAM_SUCCESS
}
mutation`
,
()
=>
{
return
testAction
({
action
:
actions
.
receiveCreateValueStreamSuccess
,
payload
:
selectedValueStream
,
state
,
expectedMutations
:
[
{
type
:
types
.
RECEIVE_CREATE_VALUE_STREAM_SUCCESS
,
payload
:
selectedValueStream
},
],
expectedActions
:
[{
type
:
'
fetchCycleAnalyticsData
'
}],
});
});
});
describe
(
'
updateValueStream
'
,
()
=>
{
describe
(
'
updateValueStream
'
,
()
=>
{
const
payload
=
{
const
payload
=
{
name
:
'
cool value stream
'
,
name
:
'
cool value stream
'
,
...
...
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
View file @
e2ae04a1
...
@@ -5,6 +5,7 @@ import * as getters from 'ee/analytics/cycle_analytics/store/getters';
...
@@ -5,6 +5,7 @@ import * as getters from 'ee/analytics/cycle_analytics/store/getters';
import
*
as
types
from
'
ee/analytics/cycle_analytics/store/mutation_types
'
;
import
*
as
types
from
'
ee/analytics/cycle_analytics/store/mutation_types
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
{
createdAfter
,
createdBefore
,
currentGroup
}
from
'
jest/cycle_analytics/mock_data
'
;
import
{
createdAfter
,
createdBefore
,
currentGroup
}
from
'
jest/cycle_analytics/mock_data
'
;
import
{
I18N_VSA_ERROR_STAGES
,
I18N_VSA_ERROR_STAGE_MEDIAN
}
from
'
~/cycle_analytics/constants
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
allowedStages
as
stages
,
valueStreams
}
from
'
../mock_data
'
;
import
{
allowedStages
as
stages
,
valueStreams
}
from
'
../mock_data
'
;
...
@@ -149,9 +150,7 @@ describe('Value Stream Analytics actions', () => {
...
@@ -149,9 +150,7 @@ describe('Value Stream Analytics actions', () => {
commit
:
()
=>
{},
commit
:
()
=>
{},
})
})
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
createFlash
).
toHaveBeenCalledWith
({
expect
(
createFlash
).
toHaveBeenCalledWith
({
message
:
I18N_VSA_ERROR_STAGE_MEDIAN
});
message
:
'
There was an error fetching median data for stages
'
,
});
});
});
});
});
...
@@ -176,7 +175,7 @@ describe('Value Stream Analytics actions', () => {
...
@@ -176,7 +175,7 @@ describe('Value Stream Analytics actions', () => {
})
})
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
createFlash
).
toHaveBeenCalledWith
({
expect
(
createFlash
).
toHaveBeenCalledWith
({
message
:
'
There was an error fetching value stream analytics stages.
'
,
message
:
I18N_VSA_ERROR_STAGES
,
});
});
});
});
});
});
...
...
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