UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Platform One
P
Party Bus
Launchboard
launchboard-be
Commits
6c9bf84f
You need to sign in or sign up before continuing.
Commit
6c9bf84f
authored
Aug 30, 2021
by
Baban Faraj
Browse files
Update unit test by mocking new Gitlab request for the latest pipeline title
parent
2badedc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
tests/service/project-service.spec.js
tests/service/project-service.spec.js
+23
-4
No files found.
tests/service/project-service.spec.js
View file @
6c9bf84f
...
@@ -252,7 +252,12 @@ describe('ProjectService', () => {
...
@@ -252,7 +252,12 @@ describe('ProjectService', () => {
})
})
// latest pipeline response
// latest pipeline response
.
mockResolvedValueOnce
({
.
mockResolvedValueOnce
({
data
:
[{
id
:
88
,
sha
:
'
123
'
,
status
:
'
success
'
,
web_url
:
'
url
'
}],
data
:
[{
id
:
88
,
sha
:
'
123
'
,
status
:
'
success
'
,
web_url
:
'
url
'
}],
})
.
mockResolvedValueOnce
({
data
:
{
title
:
'
title
'
}
})
})
// pipeline jobs response
// pipeline jobs response
.
mockResolvedValueOnce
({
.
mockResolvedValueOnce
({
...
@@ -273,11 +278,12 @@ describe('ProjectService', () => {
...
@@ -273,11 +278,12 @@ describe('ProjectService', () => {
name
:
'
123
'
,
name
:
'
123
'
,
latestPipeline
:
'
url
'
,
latestPipeline
:
'
url
'
,
status
:
'
passed
'
,
status
:
'
passed
'
,
message
:
'
title
'
,
},
},
},
},
]);
]);
expect
(
axios
.
get
).
toHaveBeenCalledTimes
(
4
);
expect
(
axios
.
get
).
toHaveBeenCalledTimes
(
5
);
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
`
${
mockBaseUrl
}
/api/v4/users?search=
${
mockEmail
}
`
,
`
${
mockBaseUrl
}
/api/v4/users?search=
${
mockEmail
}
`
,
mockHeaders
mockHeaders
...
@@ -308,6 +314,11 @@ describe('ProjectService', () => {
...
@@ -308,6 +314,11 @@ describe('ProjectService', () => {
.
mockResolvedValueOnce
({
.
mockResolvedValueOnce
({
data
:
[{
id
:
88
,
sha
:
'
123
'
,
status
:
'
success
'
,
web_url
:
'
url
'
}],
data
:
[{
id
:
88
,
sha
:
'
123
'
,
status
:
'
success
'
,
web_url
:
'
url
'
}],
})
})
.
mockResolvedValueOnce
({
data
:
{
title
:
'
title
'
}
})
// pipeline jobs response
// pipeline jobs response
.
mockResolvedValueOnce
({
.
mockResolvedValueOnce
({
data
:
'
dummy
'
,
data
:
'
dummy
'
,
...
@@ -327,11 +338,12 @@ describe('ProjectService', () => {
...
@@ -327,11 +338,12 @@ describe('ProjectService', () => {
name
:
'
123
'
,
name
:
'
123
'
,
latestPipeline
:
'
url
'
,
latestPipeline
:
'
url
'
,
status
:
'
passed
'
,
status
:
'
passed
'
,
message
:
'
title
'
,
},
},
},
},
]);
]);
expect
(
axios
.
get
).
toHaveBeenCalledTimes
(
4
);
expect
(
axios
.
get
).
toHaveBeenCalledTimes
(
5
);
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
`
${
mockBaseUrl
}
/api/v4/users?search=
${
mockEmail
}
`
,
`
${
mockBaseUrl
}
/api/v4/users?search=
${
mockEmail
}
`
,
mockHeaders
mockHeaders
...
@@ -362,6 +374,11 @@ describe('ProjectService', () => {
...
@@ -362,6 +374,11 @@ describe('ProjectService', () => {
.
mockResolvedValueOnce
({
.
mockResolvedValueOnce
({
data
:
[{
id
:
88
,
sha
:
'
123
'
,
status
:
'
failed
'
,
web_url
:
'
url
'
}],
data
:
[{
id
:
88
,
sha
:
'
123
'
,
status
:
'
failed
'
,
web_url
:
'
url
'
}],
})
})
.
mockResolvedValueOnce
({
data
:
{
title
:
'
title
'
}
})
// pipeline jobs response
// pipeline jobs response
.
mockResolvedValueOnce
({
.
mockResolvedValueOnce
({
data
:
[
data
:
[
...
@@ -370,6 +387,7 @@ describe('ProjectService', () => {
...
@@ -370,6 +387,7 @@ describe('ProjectService', () => {
],
],
});
});
const
response
=
await
ProjectService
.
getProjectsLatestPipelineAndJobs
(
const
response
=
await
ProjectService
.
getProjectsLatestPipelineAndJobs
(
mockEmail
mockEmail
);
);
...
@@ -394,12 +412,13 @@ describe('ProjectService', () => {
...
@@ -394,12 +412,13 @@ describe('ProjectService', () => {
],
],
name
:
'
123
'
,
name
:
'
123
'
,
latestPipeline
:
'
url
'
,
latestPipeline
:
'
url
'
,
message
:
'
title
'
,
status
:
'
failed
'
,
status
:
'
failed
'
,
},
},
},
},
]);
]);
expect
(
axios
.
get
).
toHaveBeenCalledTimes
(
4
);
expect
(
axios
.
get
).
toHaveBeenCalledTimes
(
5
);
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
`
${
mockBaseUrl
}
/api/v4/users?search=
${
mockEmail
}
`
,
`
${
mockBaseUrl
}
/api/v4/users?search=
${
mockEmail
}
`
,
mockHeaders
mockHeaders
...
...
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