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
Show 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', () => {
...
@@ -8,13 +8,13 @@ describe('JiraConnect API', () => {
let
mock
;
let
mock
;
let
response
;
let
response
;
const
a
ddPath
=
'
addPath
'
;
const
mockA
ddPath
=
'
addPath
'
;
const
r
emovePath
=
'
removePath
'
;
const
mockR
emovePath
=
'
removePath
'
;
const
n
amespace
=
'
namespace
'
;
const
mockN
amespace
=
'
namespace
'
;
const
j
wt
=
'
jwt
'
;
const
mockJ
wt
=
'
jwt
'
;
const
success
Response
=
{
success
:
true
};
const
mock
Response
=
{
success
:
true
};
const
tokenSpy
=
jest
.
fn
().
mockReturnValue
(
j
wt
);
const
tokenSpy
=
jest
.
fn
().
mockReturnValue
(
mockJ
wt
);
window
.
AP
=
{
window
.
AP
=
{
context
:
{
context
:
{
...
@@ -32,44 +32,44 @@ describe('JiraConnect API', () => {
...
@@ -32,44 +32,44 @@ describe('JiraConnect API', () => {
});
});
describe
(
'
addSubscription
'
,
()
=>
{
describe
(
'
addSubscription
'
,
()
=>
{
const
makeRequest
=
()
=>
addSubscription
(
addPath
,
n
amespace
);
const
makeRequest
=
()
=>
addSubscription
(
mockAddPath
,
mockN
amespace
);
it
(
'
returns success response
'
,
async
()
=>
{
it
(
'
returns success response
'
,
async
()
=>
{
jest
.
spyOn
(
axios
,
'
post
'
);
jest
.
spyOn
(
axios
,
'
post
'
);
mock
mock
.
onPost
(
a
ddPath
,
{
.
onPost
(
mockA
ddPath
,
{
jwt
,
jwt
:
mockJwt
,
namespace_path
:
n
amespace
,
namespace_path
:
mockN
amespace
,
})
})
.
replyOnce
(
httpStatus
.
OK
,
success
Response
);
.
replyOnce
(
httpStatus
.
OK
,
mock
Response
);
response
=
await
makeRequest
();
response
=
await
makeRequest
();
expect
(
tokenSpy
).
toHaveBeenCalled
();
expect
(
tokenSpy
).
toHaveBeenCalled
();
expect
(
axios
.
post
).
toHaveBeenCalledWith
(
a
ddPath
,
{
expect
(
axios
.
post
).
toHaveBeenCalledWith
(
mockA
ddPath
,
{
jwt
,
jwt
:
mockJwt
,
namespace_path
:
n
amespace
,
namespace_path
:
mockN
amespace
,
});
});
expect
(
response
.
data
).
toEqual
(
success
Response
);
expect
(
response
.
data
).
toEqual
(
mock
Response
);
});
});
});
});
describe
(
'
removeSubscription
'
,
()
=>
{
describe
(
'
removeSubscription
'
,
()
=>
{
const
makeRequest
=
()
=>
removeSubscription
(
r
emovePath
);
const
makeRequest
=
()
=>
removeSubscription
(
mockR
emovePath
);
it
(
'
returns success response
'
,
async
()
=>
{
it
(
'
returns success response
'
,
async
()
=>
{
jest
.
spyOn
(
axios
,
'
delete
'
);
jest
.
spyOn
(
axios
,
'
delete
'
);
mock
.
onDelete
(
removePath
).
replyOnce
(
httpStatus
.
OK
,
success
Response
);
mock
.
onDelete
(
mockRemovePath
).
replyOnce
(
httpStatus
.
OK
,
mock
Response
);
response
=
await
makeRequest
();
response
=
await
makeRequest
();
expect
(
tokenSpy
).
toHaveBeenCalled
();
expect
(
tokenSpy
).
toHaveBeenCalled
();
expect
(
axios
.
delete
).
toHaveBeenCalledWith
(
r
emovePath
,
{
expect
(
axios
.
delete
).
toHaveBeenCalledWith
(
mockR
emovePath
,
{
params
:
{
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