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
f35d1ccc
Commit
f35d1ccc
authored
Mar 23, 2021
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update with review notes about unit tests
parent
ce92275f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
spec/frontend/mr_notes/stores/actions_spec.js
spec/frontend/mr_notes/stores/actions_spec.js
+6
-7
No files found.
spec/frontend/mr_notes/stores/actions_spec.js
View file @
f35d1ccc
...
...
@@ -28,10 +28,10 @@ describe('MR Notes Mutator Actions', () => {
});
describe
(
'
setMrMetadata
'
,
()
=>
{
it
(
'
should trigger the SET_MR_METADATA state mutation
'
,
(
done
)
=>
{
it
(
'
should trigger the SET_MR_METADATA state mutation
'
,
async
(
)
=>
{
const
mrMetadata
=
{
propA
:
'
a
'
,
propB
:
'
b
'
};
testAction
(
await
testAction
(
setMrMetadata
,
mrMetadata
,
{},
...
...
@@ -42,7 +42,6 @@ describe('MR Notes Mutator Actions', () => {
},
],
[],
done
,
);
});
});
...
...
@@ -54,25 +53,25 @@ describe('MR Notes Mutator Actions', () => {
metadata
:
'
metadata
'
,
},
};
let
getSpy
;
let
mock
;
beforeEach
(()
=>
{
getSpy
=
jest
.
spyOn
(
axios
,
'
get
'
);
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
(
state
.
endpoints
.
metadata
).
reply
(
200
,
mrMetadata
);
});
afterEach
(()
=>
{
getSpy
.
mockRestore
();
mock
.
restore
();
});
it
(
'
should fetch the data from the API
'
,
async
()
=>
{
await
fetchMrMetadata
({
state
,
dispatch
:
()
=>
{}
});
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
state
.
endpoints
.
metadata
);
await
axios
.
waitForAll
();
expect
(
mock
.
history
.
get
).
toHaveLength
(
1
);
expect
(
mock
.
history
.
get
[
0
].
url
).
toBe
(
state
.
endpoints
.
metadata
);
});
it
(
'
should set the fetched data into state
'
,
()
=>
{
...
...
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