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
4d7d8dde
Commit
4d7d8dde
authored
Jun 29, 2020
by
jakeburden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make testing DRYer
parent
e40e2d04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
21 deletions
+16
-21
spec/frontend/notes/components/note_actions_spec.js
spec/frontend/notes/components/note_actions_spec.js
+16
-21
No files found.
spec/frontend/notes/components/note_actions_spec.js
View file @
4d7d8dde
...
...
@@ -135,11 +135,17 @@ describe('noteActions', () => {
});
describe
(
'
when a user has access to edit an issue
'
,
()
=>
{
beforeEach
(
()
=>
{
const
testButtonClickTriggersAction
=
()
=>
{
axiosMock
.
onPut
(
`
${
TEST_HOST
}
/api/v4/projects/group/project/issues/1`
).
reply
(()
=>
{
expect
(
actions
.
updateAssignees
).
toHaveBeenCalled
();
});
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
true
);
assignUserButton
.
trigger
(
'
click
'
);
};
beforeEach
(()
=>
{
store
.
dispatch
(
'
setUserData
'
,
userDataMock
);
store
.
dispatch
(
'
setNoteableData
'
,
{
current_user
:
{
...
...
@@ -157,20 +163,16 @@ describe('noteActions', () => {
axiosMock
.
restore
();
});
it
(
'
should be possible to assign the comment author
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
true
);
assignUserButton
.
trigger
(
'
click
'
);
});
it
(
'
should be possible to unassign the comment author
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
true
);
assignUserButton
.
trigger
(
'
click
'
);
});
it
(
'
should be possible to assign the comment author
'
,
testButtonClickTriggersAction
);
it
(
'
should be possible to unassign the comment author
'
,
testButtonClickTriggersAction
);
});
describe
(
'
when a user does not have access to edit an issue
'
,
()
=>
{
const
testButtonDoesNotRender
=
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
false
);
};
beforeEach
(()
=>
{
wrapper
=
shallowMountNoteActions
(
props
,
{
targetType
:
()
=>
'
issue
'
,
...
...
@@ -181,15 +183,8 @@ describe('noteActions', () => {
wrapper
.
destroy
();
});
it
(
'
should not be possible to assign the comment author
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
false
);
});
it
(
'
should not be possible to unassign the comment author
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
false
);
});
it
(
'
should not be possible to assign the comment author
'
,
testButtonDoesNotRender
);
it
(
'
should not be possible to unassign the comment author
'
,
testButtonDoesNotRender
);
});
describe
(
'
user is not logged in
'
,
()
=>
{
...
...
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