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
ff4ee180
Commit
ff4ee180
authored
Mar 03, 2020
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test that snowplow is called with the correct information
parent
8e7dd179
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
spec/frontend/notes/components/discussion_jump_to_next_button_spec.js
...d/notes/components/discussion_jump_to_next_button_spec.js
+19
-4
No files found.
spec/frontend/notes/components/discussion_jump_to_next_button_spec.js
View file @
ff4ee180
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
JumpToNextDiscussionButton
from
'
~/notes/components/discussion_jump_to_next_button.vue
'
;
import
{
mockTracking
}
from
'
../../helpers/tracking_helper
'
;
describe
(
'
JumpToNextDiscussionButton
'
,
()
=>
{
let
wrapper
;
const
fromDiscussionId
=
'
abc123
'
;
let
wrapper
;
let
trackingSpy
;
let
jumpFn
;
beforeEach
(()
=>
{
jumpFn
=
jest
.
fn
();
wrapper
=
shallowMount
(
JumpToNextDiscussionButton
,
{
propsData
:
{
fromDiscussionId
},
});
wrapper
.
setMethods
({
jumpToNextRelativeDiscussion
:
jumpFn
});
trackingSpy
=
mockTracking
(
'
_category_
'
,
wrapper
.
element
,
jest
.
spyOn
);
});
afterEach
(()
=>
{
...
...
@@ -20,9 +27,17 @@ describe('JumpToNextDiscussionButton', () => {
});
it
(
'
calls jumpToNextRelativeDiscussion when clicked
'
,
()
=>
{
const
jumpToNextRelativeDiscussion
=
jest
.
fn
();
wrapper
.
setMethods
({
jumpToNextRelativeDiscussion
});
wrapper
.
find
({
ref
:
'
button
'
}).
trigger
(
'
click
'
);
expect
(
jumpToNextRelativeDiscussion
).
toHaveBeenCalledWith
(
fromDiscussionId
);
expect
(
jumpFn
).
toHaveBeenCalledWith
(
fromDiscussionId
);
});
it
(
'
sends the correct tracking event when clicked
'
,
()
=>
{
wrapper
.
find
({
ref
:
'
button
'
}).
trigger
(
'
click
'
);
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
'
_category_
'
,
'
click_button
'
,
{
label
:
'
mr_next_unresolved_thread
'
,
property
:
'
click_next_unresolved_thread
'
,
});
});
});
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