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
5a4185bc
Commit
5a4185bc
authored
Jan 05, 2021
by
Justin Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update const names to be more readable
parent
b394ef8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
spec/frontend/jira_connect/api_spec.js
spec/frontend/jira_connect/api_spec.js
+20
-20
No files found.
spec/frontend/jira_connect/api_spec.js
View file @
5a4185bc
...
...
@@ -8,13 +8,13 @@ describe('JiraConnect API', () => {
let
mock
;
let
response
;
const
a
ddPath
=
'
addPath
'
;
const
r
emovePath
=
'
removePath
'
;
const
n
amespace
=
'
namespace
'
;
const
j
wt
=
'
jwt
'
;
const
success
Response
=
{
success
:
true
};
const
mockA
ddPath
=
'
addPath
'
;
const
mockR
emovePath
=
'
removePath
'
;
const
mockN
amespace
=
'
namespace
'
;
const
mockJ
wt
=
'
jwt
'
;
const
mock
Response
=
{
success
:
true
};
const
tokenSpy
=
jest
.
fn
().
mockReturnValue
(
j
wt
);
const
tokenSpy
=
jest
.
fn
().
mockReturnValue
(
mockJ
wt
);
window
.
AP
=
{
context
:
{
...
...
@@ -32,44 +32,44 @@ describe('JiraConnect API', () => {
});
describe
(
'
addSubscription
'
,
()
=>
{
const
makeRequest
=
()
=>
addSubscription
(
addPath
,
n
amespace
);
const
makeRequest
=
()
=>
addSubscription
(
mockAddPath
,
mockN
amespace
);
it
(
'
returns success response
'
,
async
()
=>
{
jest
.
spyOn
(
axios
,
'
post
'
);
mock
.
onPost
(
a
ddPath
,
{
jwt
,
namespace_path
:
n
amespace
,
.
onPost
(
mockA
ddPath
,
{
jwt
:
mockJwt
,
namespace_path
:
mockN
amespace
,
})
.
replyOnce
(
httpStatus
.
OK
,
success
Response
);
.
replyOnce
(
httpStatus
.
OK
,
mock
Response
);
response
=
await
makeRequest
();
expect
(
tokenSpy
).
toHaveBeenCalled
();
expect
(
axios
.
post
).
toHaveBeenCalledWith
(
a
ddPath
,
{
jwt
,
namespace_path
:
n
amespace
,
expect
(
axios
.
post
).
toHaveBeenCalledWith
(
mockA
ddPath
,
{
jwt
:
mockJwt
,
namespace_path
:
mockN
amespace
,
});
expect
(
response
.
data
).
toEqual
(
success
Response
);
expect
(
response
.
data
).
toEqual
(
mock
Response
);
});
});
describe
(
'
removeSubscription
'
,
()
=>
{
const
makeRequest
=
()
=>
removeSubscription
(
r
emovePath
);
const
makeRequest
=
()
=>
removeSubscription
(
mockR
emovePath
);
it
(
'
returns success response
'
,
async
()
=>
{
jest
.
spyOn
(
axios
,
'
delete
'
);
mock
.
onDelete
(
removePath
).
replyOnce
(
httpStatus
.
OK
,
success
Response
);
mock
.
onDelete
(
mockRemovePath
).
replyOnce
(
httpStatus
.
OK
,
mock
Response
);
response
=
await
makeRequest
();
expect
(
tokenSpy
).
toHaveBeenCalled
();
expect
(
axios
.
delete
).
toHaveBeenCalledWith
(
r
emovePath
,
{
expect
(
axios
.
delete
).
toHaveBeenCalledWith
(
mockR
emovePath
,
{
params
:
{
jwt
,
jwt
:
mockJwt
,
},
});
expect
(
response
.
data
).
toEqual
(
success
Response
);
expect
(
response
.
data
).
toEqual
(
mock
Response
);
});
});
});
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