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
10b7caba
Commit
10b7caba
authored
3 years ago
by
NataliaTepluhina
Committed by
Heinrich Lee Yu
3 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unit test for fetchDiscussionsBatch
parent
b25c3ba2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
3 deletions
+51
-3
spec/frontend/notes/stores/actions_spec.js
spec/frontend/notes/stores/actions_spec.js
+51
-3
No files found.
spec/frontend/notes/stores/actions_spec.js
View file @
10b7caba
...
@@ -1407,7 +1407,7 @@ describe('Actions Notes Store', () => {
...
@@ -1407,7 +1407,7 @@ describe('Actions Notes Store', () => {
axiosMock
.
onAny
().
reply
(
200
,
{
discussion
});
axiosMock
.
onAny
().
reply
(
200
,
{
discussion
});
testAction
(
testAction
(
actions
.
fetchDiscussions
,
actions
.
fetchDiscussions
,
true
,
{}
,
null
,
null
,
[
[
{
type
:
mutationTypes
.
ADD_OR_UPDATE_DISCUSSIONS
,
payload
:
{
discussion
}
},
{
type
:
mutationTypes
.
ADD_OR_UPDATE_DISCUSSIONS
,
payload
:
{
discussion
}
},
...
@@ -1423,13 +1423,61 @@ describe('Actions Notes Store', () => {
...
@@ -1423,13 +1423,61 @@ describe('Actions Notes Store', () => {
testAction
(
testAction
(
actions
.
fetchDiscussions
,
actions
.
fetchDiscussions
,
true
,
{
path
:
'
test-path
'
,
filter
:
'
test-filter
'
,
persistFilter
:
'
test-persist-filter
'
}
,
null
,
null
,
[],
[],
[
[
{
{
type
:
'
fetchDiscussionsBatch
'
,
type
:
'
fetchDiscussionsBatch
'
,
payload
:
{
config
:
null
,
path
:
undefined
,
perPage
:
20
},
payload
:
{
config
:
{
params
:
{
notes_filter
:
'
test-filter
'
,
persist_filter
:
'
test-persist-filter
'
},
},
path
:
'
test-path
'
,
perPage
:
20
,
},
},
],
done
,
);
});
});
describe
(
'
fetchDiscussionsBatch
'
,
()
=>
{
const
discussion
=
{
notes
:
[]
};
const
config
=
{
params
:
{
notes_filter
:
'
test-filter
'
,
persist_filter
:
'
test-persist-filter
'
},
};
const
actionPayload
=
{
config
,
path
:
'
test-path
'
,
perPage
:
20
};
it
(
'
updates the discussions and dispatches `updateResolvableDiscussionsCounts if there are no headers
'
,
(
done
)
=>
{
axiosMock
.
onAny
().
reply
(
200
,
{
discussion
},
{});
testAction
(
actions
.
fetchDiscussionsBatch
,
actionPayload
,
null
,
[
{
type
:
mutationTypes
.
ADD_OR_UPDATE_DISCUSSIONS
,
payload
:
{
discussion
}
},
{
type
:
mutationTypes
.
SET_FETCHING_DISCUSSIONS
,
payload
:
false
},
],
[{
type
:
'
updateResolvableDiscussionsCounts
'
}],
done
,
);
});
it
(
'
dispatches itself if there is `x-next-page-cursor` header
'
,
(
done
)
=>
{
axiosMock
.
onAny
().
reply
(
200
,
{
discussion
},
{
'
x-next-page-cursor
'
:
1
});
testAction
(
actions
.
fetchDiscussionsBatch
,
actionPayload
,
null
,
[{
type
:
mutationTypes
.
ADD_OR_UPDATE_DISCUSSIONS
,
payload
:
{
discussion
}
}],
[
{
type
:
'
fetchDiscussionsBatch
'
,
payload
:
{
...
actionPayload
,
perPage
:
30
,
cursor
:
1
},
},
},
],
],
done
,
done
,
...
...
This diff is collapsed.
Click to expand it.
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