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
c882d163
Commit
c882d163
authored
Feb 23, 2021
by
peterhegman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor spec to use `describe.each`
Per reviewer feedback
parent
7c57de4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
16 deletions
+8
-16
spec/frontend/members/utils_spec.js
spec/frontend/members/utils_spec.js
+8
-16
No files found.
spec/frontend/members/utils_spec.js
View file @
c882d163
...
...
@@ -60,27 +60,19 @@ describe('Members Utils', () => {
});
describe
(
'
when `canManageMembers` argument is `false`
'
,
()
=>
{
describe
(
'
when member is not the current user
'
,
()
=>
{
it
(
'
sets `show` to `false` for 2FA badge
'
,
()
=>
{
describe
.
each
`
description | memberIsCurrentUser | expectedBadgeToBeShown
${
'
is not the current user
'
}
|
${
false
}
|
${
false
}
${
'
is the current user
'
}
|
${
true
}
|
${
true
}
`
(
'
when member is $description
'
,
({
memberIsCurrentUser
,
expectedBadgeToBeShown
})
=>
{
it
(
`sets 'show' to '
${
expectedBadgeToBeShown
}
' for 2FA badge`
,
()
=>
{
const
badges
=
generateBadges
({
member
:
member2faEnabled
,
isCurrentUser
:
false
,
isCurrentUser
:
memberIsCurrentUser
,
canManageMembers
:
false
,
});
expect
(
badges
.
find
((
badge
)
=>
badge
.
text
===
'
2FA
'
).
show
).
toBe
(
false
);
});
});
describe
(
'
when member is the current user
'
,
()
=>
{
it
(
'
sets `show` to `false` for 2fA badge
'
,
()
=>
{
const
badges
=
generateBadges
({
member
:
member2faEnabled
,
isCurrentUser
:
true
,
canManageMembers
:
false
,
});
expect
(
badges
.
find
((
badge
)
=>
badge
.
text
===
'
2FA
'
).
show
).
toBe
(
true
);
expect
(
badges
.
find
((
badge
)
=>
badge
.
text
===
'
2FA
'
).
show
).
toBe
(
expectedBadgeToBeShown
);
});
});
});
...
...
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