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
6769acb9
Commit
6769acb9
authored
Mar 22, 2020
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use it.each for parseBoolean
parent
436f47e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
25 deletions
+10
-25
spec/frontend/lib/utils/common_utils_spec.js
spec/frontend/lib/utils/common_utils_spec.js
+10
-25
No files found.
spec/frontend/lib/utils/common_utils_spec.js
View file @
6769acb9
...
...
@@ -359,31 +359,16 @@ describe('common_utils', () => {
});
describe
(
'
parseBoolean
'
,
()
=>
{
const
{
parseBoolean
}
=
commonUtils
;
it
(
'
returns true for "true"
'
,
()
=>
{
expect
(
parseBoolean
(
'
true
'
)).
toEqual
(
true
);
});
it
(
'
returns false for "false"
'
,
()
=>
{
expect
(
parseBoolean
(
'
false
'
)).
toEqual
(
false
);
});
it
(
'
returns false for "something"
'
,
()
=>
{
expect
(
parseBoolean
(
'
something
'
)).
toEqual
(
false
);
});
it
(
'
returns false for null
'
,
()
=>
{
expect
(
parseBoolean
(
null
)).
toEqual
(
false
);
});
it
(
'
is idempotent
'
,
()
=>
{
const
input
=
[
'
true
'
,
'
false
'
,
'
something
'
,
null
];
input
.
forEach
(
value
=>
{
const
result
=
parseBoolean
(
value
);
expect
(
parseBoolean
(
result
)).
toBe
(
result
);
});
it
.
each
`
input | expected
${
'
true
'
}
|
${
true
}
${
'
false
'
}
|
${
false
}
${
'
something
'
}
|
${
false
}
${
null
}
|
${
false
}
${
true
}
|
${
true
}
${
false
}
|
${
false
}
`
(
'
returns $expected for $input
'
,
({
input
,
expected
})
=>
{
expect
(
commonUtils
.
parseBoolean
(
input
)).
toBe
(
expected
);
});
});
...
...
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