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
43d74305
Commit
43d74305
authored
Feb 10, 2021
by
Scott Hampton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `it.each` for util spec
Utilize `it.each` to make a cleaner spec file for the util function.
parent
ce6d8bae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
38 deletions
+10
-38
spec/frontend/pipelines/test_reports/stores/utils_spec.js
spec/frontend/pipelines/test_reports/stores/utils_spec.js
+10
-38
No files found.
spec/frontend/pipelines/test_reports/stores/utils_spec.js
View file @
43d74305
...
...
@@ -2,44 +2,16 @@ import { formatFilePath, formattedTime } from '~/pipelines/stores/test_reports/u
describe
(
'
Test reports utils
'
,
()
=>
{
describe
(
'
formatFilePath
'
,
()
=>
{
describe
(
'
when file string starts with "./"
'
,
()
=>
{
it
(
'
should return the file string without the beginning "./"
'
,
()
=>
{
const
result
=
formatFilePath
(
'
./test.js
'
);
expect
(
result
).
toBe
(
'
test.js
'
);
});
});
describe
(
'
when file string starts with "/"
'
,
()
=>
{
it
(
'
should return the file string without the beginning "/"
'
,
()
=>
{
const
result
=
formatFilePath
(
'
/test.js
'
);
expect
(
result
).
toBe
(
'
test.js
'
);
});
});
describe
(
'
when file string starts with more than one "/"
'
,
()
=>
{
it
(
'
should return the file string without any of the beginning "/"
'
,
()
=>
{
const
result
=
formatFilePath
(
'
.//////////////test.js
'
);
expect
(
result
).
toBe
(
'
test.js
'
);
});
});
describe
(
'
when file string starts without either "." or "/"
'
,
()
=>
{
it
(
'
should return the file string without change
'
,
()
=>
{
const
result
=
formatFilePath
(
'
test.js
'
);
expect
(
result
).
toBe
(
'
test.js
'
);
});
});
describe
(
'
when file string contains but does not start with "./"
'
,
()
=>
{
it
(
'
should return the file string without change
'
,
()
=>
{
const
result
=
formatFilePath
(
'
mock/path./test.js
'
);
expect
(
result
).
toBe
(
'
mock/path./test.js
'
);
});
it
.
each
`
file | expected
${
'
./test.js
'
}
|
${
'
test.js
'
}
${
'
/test.js
'
}
|
${
'
test.js
'
}
${
'
.//////////////test.js
'
}
|
${
'
test.js
'
}
${
'
test.js
'
}
|
${
'
test.js
'
}
${
'
mock/path./test.js
'
}
|
${
'
mock/path./test.js
'
}
${
'
./mock/path./test.js
'
}
|
${
'
mock/path./test.js
'
}
`
(
'
should format $file to be $expected
'
,
({
file
,
expected
})
=>
{
expect
(
formatFilePath
(
file
)).
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