Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
a96b9ebf
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a96b9ebf
编写于
5月 06, 2019
作者:
F
Filipa Lacerda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removes fetchStage actions and mutations
Updates tests
上级
cc4a0d9a
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
145 addition
and
327 deletion
+145
-327
app/assets/javascripts/jobs/components/job_app.vue
app/assets/javascripts/jobs/components/job_app.vue
+5
-2
app/assets/javascripts/jobs/components/sidebar.vue
app/assets/javascripts/jobs/components/sidebar.vue
+1
-2
app/assets/javascripts/jobs/store/actions.js
app/assets/javascripts/jobs/store/actions.js
+0
-17
app/assets/javascripts/jobs/store/mutation_types.js
app/assets/javascripts/jobs/store/mutation_types.js
+0
-4
app/assets/javascripts/jobs/store/mutations.js
app/assets/javascripts/jobs/store/mutations.js
+2
-12
app/assets/javascripts/jobs/store/state.js
app/assets/javascripts/jobs/store/state.js
+0
-1
spec/frontend/jobs/store/mutations_spec.js
spec/frontend/jobs/store/mutations_spec.js
+1
-37
spec/javascripts/jobs/components/sidebar_spec.js
spec/javascripts/jobs/components/sidebar_spec.js
+1
-13
spec/javascripts/jobs/mock_data.js
spec/javascripts/jobs/mock_data.js
+135
-134
spec/javascripts/jobs/store/actions_spec.js
spec/javascripts/jobs/store/actions_spec.js
+0
-105
未找到文件。
app/assets/javascripts/jobs/components/job_app.vue
浏览文件 @
a96b9ebf
...
...
@@ -86,6 +86,7 @@ export default {
'
isScrollTopDisabled
'
,
'
isScrolledToBottomBeforeReceivingTrace
'
,
'
hasError
'
,
'
selectedStage
'
,
]),
...
mapGetters
([
'
headerTime
'
,
...
...
@@ -121,7 +122,9 @@ export default {
// fetch the stages for the dropdown on the sidebar
job
(
newVal
,
oldVal
)
{
if
(
_
.
isEmpty
(
oldVal
)
&&
!
_
.
isEmpty
(
newVal
.
pipeline
))
{
this
.
fetchStages
();
this
.
fetchJobsForStage
(
this
.
job
.
pipeline
.
details
.
stages
.
find
(
stage
=>
stage
&&
stage
.
name
===
this
.
selectedStage
),
);
}
if
(
newVal
.
archived
)
{
...
...
@@ -160,7 +163,7 @@ export default {
'
setJobEndpoint
'
,
'
setTraceOptions
'
,
'
fetchJob
'
,
'
fetch
Stages
'
,
'
fetch
JobsForStage
'
,
'
hideSidebar
'
,
'
showSidebar
'
,
'
toggleSidebar
'
,
...
...
app/assets/javascripts/jobs/components/sidebar.vue
浏览文件 @
a96b9ebf
...
...
@@ -34,7 +34,7 @@ export default {
},
},
computed
:
{
...
mapState
([
'
job
'
,
'
stages
'
,
'
jobs
'
,
'
selectedStage
'
,
'
isLoadingStages
'
]),
...
mapState
([
'
job
'
,
'
stages
'
,
'
jobs
'
,
'
selectedStage
'
]),
coverage
()
{
return
`
${
this
.
job
.
coverage
}
%`
;
},
...
...
@@ -208,7 +208,6 @@ export default {
/>
<stages-dropdown
v-if=
"!isLoadingStages"
:stages=
"stages"
:pipeline=
"job.pipeline"
:selected-stage=
"selectedStage"
...
...
app/assets/javascripts/jobs/store/actions.js
浏览文件 @
a96b9ebf
...
...
@@ -178,23 +178,6 @@ export const receiveTraceError = ({ commit }) => {
flash
(
__
(
'
An error occurred while fetching the job log.
'
));
};
/**
* Stages dropdown on sidebar
*/
export
const
requestStages
=
({
commit
})
=>
commit
(
types
.
REQUEST_STAGES
);
export
const
fetchStages
=
({
state
,
dispatch
})
=>
{
dispatch
(
'
requestStages
'
);
dispatch
(
'
receiveStagesSuccess
'
,
state
.
job
.
pipeline
.
details
.
stages
);
const
selectedStage
=
state
.
job
.
pipeline
.
details
.
stages
.
find
(
stage
=>
stage
.
name
===
state
.
selectedStage
);
dispatch
(
'
fetchJobsForStage
'
,
selectedStage
);
};
export
const
receiveStagesSuccess
=
({
commit
},
data
)
=>
commit
(
types
.
RECEIVE_STAGES_SUCCESS
,
data
);
export
const
receiveStagesError
=
({
commit
})
=>
{
commit
(
types
.
RECEIVE_STAGES_ERROR
);
flash
(
__
(
'
An error occurred while fetching stages.
'
));
};
/**
* Jobs list on sidebar - depend on stages dropdown
*/
...
...
app/assets/javascripts/jobs/store/mutation_types.js
浏览文件 @
a96b9ebf
...
...
@@ -24,10 +24,6 @@ export const STOP_POLLING_TRACE = 'STOP_POLLING_TRACE';
export
const
RECEIVE_TRACE_SUCCESS
=
'
RECEIVE_TRACE_SUCCESS
'
;
export
const
RECEIVE_TRACE_ERROR
=
'
RECEIVE_TRACE_ERROR
'
;
export
const
REQUEST_STAGES
=
'
REQUEST_STAGES
'
;
export
const
RECEIVE_STAGES_SUCCESS
=
'
RECEIVE_STAGES_SUCCESS
'
;
export
const
RECEIVE_STAGES_ERROR
=
'
RECEIVE_STAGES_ERROR
'
;
export
const
SET_SELECTED_STAGE
=
'
SET_SELECTED_STAGE
'
;
export
const
REQUEST_JOBS_FOR_STAGE
=
'
REQUEST_JOBS_FOR_STAGE
'
;
export
const
RECEIVE_JOBS_FOR_STAGE_SUCCESS
=
'
RECEIVE_JOBS_FOR_STAGE_SUCCESS
'
;
...
...
app/assets/javascripts/jobs/store/mutations.js
浏览文件 @
a96b9ebf
...
...
@@ -65,6 +65,8 @@ export default {
state
.
isLoading
=
false
;
state
.
job
=
job
;
state
.
stages
=
job
.
pipeline
.
details
.
stages
||
[];
/**
* We only update it on the first request
* The dropdown can be changed by the user
...
...
@@ -101,18 +103,6 @@ export default {
state
.
isScrolledToBottomBeforeReceivingTrace
=
toggle
;
},
[
types
.
REQUEST_STAGES
](
state
)
{
state
.
isLoadingStages
=
true
;
},
[
types
.
RECEIVE_STAGES_SUCCESS
](
state
,
stages
)
{
state
.
isLoadingStages
=
false
;
state
.
stages
=
stages
;
},
[
types
.
RECEIVE_STAGES_ERROR
](
state
)
{
state
.
isLoadingStages
=
false
;
state
.
stages
=
[];
},
[
types
.
REQUEST_JOBS_FOR_STAGE
](
state
,
stage
)
{
state
.
isLoadingJobs
=
true
;
state
.
selectedStage
=
stage
.
name
;
...
...
app/assets/javascripts/jobs/store/state.js
浏览文件 @
a96b9ebf
...
...
@@ -25,7 +25,6 @@ export default () => ({
traceState
:
null
,
// sidebar dropdown & list of jobs
isLoadingStages
:
false
,
isLoadingJobs
:
false
,
selectedStage
:
''
,
stages
:
[],
...
...
spec/frontend/jobs/store/mutations_spec.js
浏览文件 @
a96b9ebf
...
...
@@ -150,44 +150,8 @@ describe('Jobs Store Mutations', () => {
});
});
describe
(
'
REQUEST_STAGES
'
,
()
=>
{
it
(
'
sets isLoadingStages to true
'
,
()
=>
{
mutations
[
types
.
REQUEST_STAGES
](
stateCopy
);
expect
(
stateCopy
.
isLoadingStages
).
toEqual
(
true
);
});
});
describe
(
'
RECEIVE_STAGES_SUCCESS
'
,
()
=>
{
beforeEach
(()
=>
{
mutations
[
types
.
RECEIVE_STAGES_SUCCESS
](
stateCopy
,
[{
name
:
'
build
'
}]);
});
it
(
'
sets isLoadingStages to false
'
,
()
=>
{
expect
(
stateCopy
.
isLoadingStages
).
toEqual
(
false
);
});
it
(
'
sets stages
'
,
()
=>
{
expect
(
stateCopy
.
stages
).
toEqual
([{
name
:
'
build
'
}]);
});
});
describe
(
'
RECEIVE_STAGES_ERROR
'
,
()
=>
{
beforeEach
(()
=>
{
mutations
[
types
.
RECEIVE_STAGES_ERROR
](
stateCopy
);
});
it
(
'
sets isLoadingStages to false
'
,
()
=>
{
expect
(
stateCopy
.
isLoadingStages
).
toEqual
(
false
);
});
it
(
'
resets stages
'
,
()
=>
{
expect
(
stateCopy
.
stages
).
toEqual
([]);
});
});
describe
(
'
REQUEST_JOBS_FOR_STAGE
'
,
()
=>
{
it
(
'
sets isLoading
Stage
s to true
'
,
()
=>
{
it
(
'
sets isLoading
Job
s to true
'
,
()
=>
{
mutations
[
types
.
REQUEST_JOBS_FOR_STAGE
](
stateCopy
,
{
name
:
'
deploy
'
});
expect
(
stateCopy
.
isLoadingJobs
).
toEqual
(
true
);
...
...
spec/javascripts/jobs/components/sidebar_spec.js
浏览文件 @
a96b9ebf
import
Vue
from
'
vue
'
;
import
sidebarDetailsBlock
from
'
~/jobs/components/sidebar.vue
'
;
import
createStore
from
'
~/jobs/store
'
;
import
job
,
{
stages
,
jobsInStage
}
from
'
../mock_data
'
;
import
job
,
{
jobsInStage
}
from
'
../mock_data
'
;
import
{
mountComponentWithStore
}
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
trimText
}
from
'
../../helpers/text_helper
'
;
...
...
@@ -131,18 +131,8 @@ describe('Sidebar details block', () => {
store
.
dispatch
(
'
receiveJobSuccess
'
,
job
);
});
describe
(
'
while fetching stages
'
,
()
=>
{
it
(
'
it does not render dropdown
'
,
()
=>
{
store
.
dispatch
(
'
requestStages
'
);
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-selected-stage
'
)).
toBeNull
();
});
});
describe
(
'
with stages
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
dispatch
(
'
receiveStagesSuccess
'
,
stages
);
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
});
...
...
@@ -156,7 +146,6 @@ describe('Sidebar details block', () => {
describe
(
'
without jobs for stages
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
dispatch
(
'
receiveJobSuccess
'
,
job
);
store
.
dispatch
(
'
receiveStagesSuccess
'
,
stages
);
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
});
...
...
@@ -168,7 +157,6 @@ describe('Sidebar details block', () => {
describe
(
'
with jobs for stages
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
dispatch
(
'
receiveJobSuccess
'
,
job
);
store
.
dispatch
(
'
receiveStagesSuccess
'
,
stages
);
store
.
dispatch
(
'
receiveJobsForStageSuccess
'
,
jobsInStage
.
latest_statuses
);
vm
=
mountComponentWithStore
(
SidebarComponent
,
{
store
});
});
...
...
spec/javascripts/jobs/mock_data.js
浏览文件 @
a96b9ebf
...
...
@@ -3,140 +3,6 @@ import { TEST_HOST } from 'spec/test_constants';
const
threeWeeksAgo
=
new
Date
();
threeWeeksAgo
.
setDate
(
threeWeeksAgo
.
getDate
()
-
21
);
export
default
{
id
:
4757
,
name
:
'
test
'
,
build_path
:
'
/root/ci-mock/-/jobs/4757
'
,
retry_path
:
'
/root/ci-mock/-/jobs/4757/retry
'
,
cancel_path
:
'
/root/ci-mock/-/jobs/4757/cancel
'
,
new_issue_path
:
'
/root/ci-mock/issues/new
'
,
playable
:
false
,
created_at
:
threeWeeksAgo
.
toISOString
(),
updated_at
:
threeWeeksAgo
.
toISOString
(),
finished_at
:
threeWeeksAgo
.
toISOString
(),
queued
:
9.54
,
status
:
{
icon
:
'
status_success
'
,
text
:
'
passed
'
,
label
:
'
passed
'
,
group
:
'
success
'
,
has_details
:
true
,
details_path
:
`
${
TEST_HOST
}
/root/ci-mock/-/jobs/4757`
,
favicon
:
'
/assets/ci_favicons/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.png
'
,
action
:
{
icon
:
'
retry
'
,
title
:
'
Retry
'
,
path
:
'
/root/ci-mock/-/jobs/4757/retry
'
,
method
:
'
post
'
,
},
},
coverage
:
20
,
erased_at
:
threeWeeksAgo
.
toISOString
(),
erased
:
false
,
duration
:
6.785563
,
tags
:
[
'
tag
'
],
user
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
erase_path
:
'
/root/ci-mock/-/jobs/4757/erase
'
,
artifacts
:
[
null
],
runner
:
{
id
:
1
,
description
:
'
local ci runner
'
,
edit_path
:
'
/root/ci-mock/runners/1/edit
'
,
},
pipeline
:
{
id
:
140
,
user
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
active
:
false
,
coverage
:
null
,
source
:
'
unknown
'
,
created_at
:
'
2017-05-24T09:59:58.634Z
'
,
updated_at
:
'
2017-06-01T17:32:00.062Z
'
,
path
:
'
/root/ci-mock/pipelines/140
'
,
flags
:
{
latest
:
true
,
stuck
:
false
,
yaml_errors
:
false
,
retryable
:
false
,
cancelable
:
false
,
},
details
:
{
status
:
{
icon
:
'
status_success
'
,
text
:
'
passed
'
,
label
:
'
passed
'
,
group
:
'
success
'
,
has_details
:
true
,
details_path
:
'
/root/ci-mock/pipelines/140
'
,
favicon
:
'
/assets/ci_favicons/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.png
'
,
},
duration
:
6
,
finished_at
:
'
2017-06-01T17:32:00.042Z
'
,
},
ref
:
{
name
:
'
abc
'
,
path
:
'
/root/ci-mock/commits/abc
'
,
tag
:
false
,
branch
:
true
,
},
commit
:
{
id
:
'
c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
short_id
:
'
c5864777
'
,
title
:
'
Add new file
'
,
created_at
:
'
2017-05-24T10:59:52.000+01:00
'
,
parent_ids
:
[
'
798e5f902592192afaba73f4668ae30e56eae492
'
],
message
:
'
Add new file
'
,
author_name
:
'
Root
'
,
author_email
:
'
admin@example.com
'
,
authored_date
:
'
2017-05-24T10:59:52.000+01:00
'
,
committer_name
:
'
Root
'
,
committer_email
:
'
admin@example.com
'
,
committed_date
:
'
2017-05-24T10:59:52.000+01:00
'
,
author
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
author_gravatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
commit_url
:
'
http://localhost:3000/root/ci-mock/commit/c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
commit_path
:
'
/root/ci-mock/commit/c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
},
},
metadata
:
{
timeout_human_readable
:
'
1m 40s
'
,
timeout_source
:
'
runner
'
,
},
merge_request
:
{
iid
:
2
,
path
:
'
/root/ci-mock/merge_requests/2
'
,
},
raw_path
:
'
/root/ci-mock/builds/4757/raw
'
,
has_trace
:
true
,
};
export
const
stages
=
[
{
name
:
'
build
'
,
...
...
@@ -1043,6 +909,141 @@ export const stages = [
},
];
export
default
{
id
:
4757
,
name
:
'
test
'
,
build_path
:
'
/root/ci-mock/-/jobs/4757
'
,
retry_path
:
'
/root/ci-mock/-/jobs/4757/retry
'
,
cancel_path
:
'
/root/ci-mock/-/jobs/4757/cancel
'
,
new_issue_path
:
'
/root/ci-mock/issues/new
'
,
playable
:
false
,
created_at
:
threeWeeksAgo
.
toISOString
(),
updated_at
:
threeWeeksAgo
.
toISOString
(),
finished_at
:
threeWeeksAgo
.
toISOString
(),
queued
:
9.54
,
status
:
{
icon
:
'
status_success
'
,
text
:
'
passed
'
,
label
:
'
passed
'
,
group
:
'
success
'
,
has_details
:
true
,
details_path
:
`
${
TEST_HOST
}
/root/ci-mock/-/jobs/4757`
,
favicon
:
'
/assets/ci_favicons/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.png
'
,
action
:
{
icon
:
'
retry
'
,
title
:
'
Retry
'
,
path
:
'
/root/ci-mock/-/jobs/4757/retry
'
,
method
:
'
post
'
,
},
},
coverage
:
20
,
erased_at
:
threeWeeksAgo
.
toISOString
(),
erased
:
false
,
duration
:
6.785563
,
tags
:
[
'
tag
'
],
user
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
erase_path
:
'
/root/ci-mock/-/jobs/4757/erase
'
,
artifacts
:
[
null
],
runner
:
{
id
:
1
,
description
:
'
local ci runner
'
,
edit_path
:
'
/root/ci-mock/runners/1/edit
'
,
},
pipeline
:
{
id
:
140
,
user
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
active
:
false
,
coverage
:
null
,
source
:
'
unknown
'
,
created_at
:
'
2017-05-24T09:59:58.634Z
'
,
updated_at
:
'
2017-06-01T17:32:00.062Z
'
,
path
:
'
/root/ci-mock/pipelines/140
'
,
flags
:
{
latest
:
true
,
stuck
:
false
,
yaml_errors
:
false
,
retryable
:
false
,
cancelable
:
false
,
},
details
:
{
status
:
{
icon
:
'
status_success
'
,
text
:
'
passed
'
,
label
:
'
passed
'
,
group
:
'
success
'
,
has_details
:
true
,
details_path
:
'
/root/ci-mock/pipelines/140
'
,
favicon
:
'
/assets/ci_favicons/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.png
'
,
},
duration
:
6
,
finished_at
:
'
2017-06-01T17:32:00.042Z
'
,
stages
:
stages
,
},
ref
:
{
name
:
'
abc
'
,
path
:
'
/root/ci-mock/commits/abc
'
,
tag
:
false
,
branch
:
true
,
},
commit
:
{
id
:
'
c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
short_id
:
'
c5864777
'
,
title
:
'
Add new file
'
,
created_at
:
'
2017-05-24T10:59:52.000+01:00
'
,
parent_ids
:
[
'
798e5f902592192afaba73f4668ae30e56eae492
'
],
message
:
'
Add new file
'
,
author_name
:
'
Root
'
,
author_email
:
'
admin@example.com
'
,
authored_date
:
'
2017-05-24T10:59:52.000+01:00
'
,
committer_name
:
'
Root
'
,
committer_email
:
'
admin@example.com
'
,
committed_date
:
'
2017-05-24T10:59:52.000+01:00
'
,
author
:
{
name
:
'
Root
'
,
username
:
'
root
'
,
id
:
1
,
state
:
'
active
'
,
avatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
web_url
:
'
http://localhost:3000/root
'
,
},
author_gravatar_url
:
'
https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80
\
u0026d=identicon
'
,
commit_url
:
'
http://localhost:3000/root/ci-mock/commit/c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
commit_path
:
'
/root/ci-mock/commit/c58647773a6b5faf066d4ad6ff2c9fbba5f180f6
'
,
},
},
metadata
:
{
timeout_human_readable
:
'
1m 40s
'
,
timeout_source
:
'
runner
'
,
},
merge_request
:
{
iid
:
2
,
path
:
'
/root/ci-mock/merge_requests/2
'
,
},
raw_path
:
'
/root/ci-mock/builds/4757/raw
'
,
has_trace
:
true
,
};
export
const
jobsInStage
=
{
name
:
'
build
'
,
title
:
'
build: running
'
,
...
...
spec/javascripts/jobs/store/actions_spec.js
浏览文件 @
a96b9ebf
...
...
@@ -16,10 +16,6 @@ import {
stopPollingTrace
,
receiveTraceSuccess
,
receiveTraceError
,
requestStages
,
fetchStages
,
receiveStagesSuccess
,
receiveStagesError
,
requestJobsForStage
,
fetchJobsForStage
,
receiveJobsForStageSuccess
,
...
...
@@ -307,107 +303,6 @@ describe('Job State actions', () => {
});
});
describe
(
'
requestStages
'
,
()
=>
{
it
(
'
should commit REQUEST_STAGES mutation
'
,
done
=>
{
testAction
(
requestStages
,
null
,
mockedState
,
[{
type
:
types
.
REQUEST_STAGES
}],
[],
done
);
});
});
describe
(
'
fetchStages
'
,
()
=>
{
let
mock
;
beforeEach
(()
=>
{
mockedState
.
job
.
pipeline
=
{
path
:
`
${
TEST_HOST
}
/endpoint`
,
};
mockedState
.
selectedStage
=
'
deploy
'
;
mock
=
new
MockAdapter
(
axios
);
});
afterEach
(()
=>
{
mock
.
restore
();
});
describe
(
'
success
'
,
()
=>
{
it
(
'
dispatches requestStages and receiveStagesSuccess, fetchJobsForStage
'
,
done
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
)
.
replyOnce
(
200
,
{
details
:
{
stages
:
[{
name
:
'
build
'
},
{
name
:
'
deploy
'
}]
}
});
testAction
(
fetchStages
,
null
,
mockedState
,
[],
[
{
type
:
'
requestStages
'
,
},
{
payload
:
[{
name
:
'
build
'
},
{
name
:
'
deploy
'
}],
type
:
'
receiveStagesSuccess
'
,
},
{
payload
:
{
name
:
'
deploy
'
},
type
:
'
fetchJobsForStage
'
,
},
],
done
,
);
});
});
describe
(
'
error
'
,
()
=>
{
beforeEach
(()
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint.json`
).
reply
(
500
);
});
it
(
'
dispatches requestStages and receiveStagesError
'
,
done
=>
{
testAction
(
fetchStages
,
null
,
mockedState
,
[],
[
{
type
:
'
requestStages
'
,
},
{
type
:
'
receiveStagesError
'
,
},
],
done
,
);
});
});
});
describe
(
'
receiveStagesSuccess
'
,
()
=>
{
it
(
'
should commit RECEIVE_STAGES_SUCCESS mutation
'
,
done
=>
{
testAction
(
receiveStagesSuccess
,
{},
mockedState
,
[{
type
:
types
.
RECEIVE_STAGES_SUCCESS
,
payload
:
{}
}],
[],
done
,
);
});
});
describe
(
'
receiveStagesError
'
,
()
=>
{
it
(
'
should commit RECEIVE_STAGES_ERROR mutation
'
,
done
=>
{
testAction
(
receiveStagesError
,
null
,
mockedState
,
[{
type
:
types
.
RECEIVE_STAGES_ERROR
}],
[],
done
,
);
});
});
describe
(
'
requestJobsForStage
'
,
()
=>
{
it
(
'
should commit REQUEST_JOBS_FOR_STAGE mutation
'
,
done
=>
{
testAction
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录