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
cefceea5
Commit
cefceea5
authored
Mar 22, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate cycle_analytics/total_time to VTU
parent
0d447785
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
spec/frontend/cycle_analytics/total_time_component_spec.js
spec/frontend/cycle_analytics/total_time_component_spec.js
+17
-17
No files found.
spec/frontend/cycle_analytics/total_time_component_spec.js
View file @
cefceea5
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
component
from
'
~/cycle_analytics/components/total_time_component.vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
TotalTime
from
'
~/cycle_analytics/components/total_time_component.vue
'
;
describe
(
'
Total time component
'
,
()
=>
{
let
vm
;
let
Component
;
let
wrapper
;
beforeEach
(()
=>
{
Component
=
Vue
.
extend
(
component
);
});
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
shallowMount
(
TotalTime
,
{
propsData
,
});
};
afterEach
(()
=>
{
vm
.
$
destroy
();
wrapper
.
destroy
();
});
describe
(
'
With data
'
,
()
=>
{
it
(
'
should render information for days and hours
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
createComponent
(
{
time
:
{
days
:
3
,
hours
:
4
,
},
});
expect
(
vm
.
$el
.
textContent
.
trim
().
replace
(
/
\s\s
+/g
,
'
'
)).
toEqual
(
'
3 days 4 hrs
'
);
expect
(
wrapper
.
text
()).
toMatchInterpolatedText
(
'
3 days 4 hrs
'
);
});
it
(
'
should render information for hours and minutes
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
createComponent
(
{
time
:
{
hours
:
4
,
mins
:
35
,
},
});
expect
(
vm
.
$el
.
textContent
.
trim
().
replace
(
/
\s\s
+/g
,
'
'
)).
toEqual
(
'
4 hrs 35 mins
'
);
expect
(
wrapper
.
text
()).
toMatchInterpolatedText
(
'
4 hrs 35 mins
'
);
});
it
(
'
should render information for seconds
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
createComponent
(
{
time
:
{
seconds
:
45
,
},
});
expect
(
vm
.
$el
.
textContent
.
trim
().
replace
(
/
\s\s
+/g
,
'
'
)).
toEqual
(
'
45 s
'
);
expect
(
wrapper
.
text
()).
toMatchInterpolatedText
(
'
45 s
'
);
});
});
describe
(
'
Without data
'
,
()
=>
{
it
(
'
should render no information
'
,
()
=>
{
vm
=
mountComponent
(
Component
);
createComponent
(
);
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
--
'
);
expect
(
wrapper
.
text
()).
toBe
(
'
--
'
);
});
});
});
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