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
519bcd2d
Commit
519bcd2d
authored
Apr 30, 2020
by
pburdette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate time ago spec to jest
Migrated time ago karma spec to jest and now using vue test utils.
parent
e70ff61f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
64 deletions
+67
-64
spec/frontend/pipelines/time_ago_spec.js
spec/frontend/pipelines/time_ago_spec.js
+67
-0
spec/javascripts/pipelines/time_ago_spec.js
spec/javascripts/pipelines/time_ago_spec.js
+0
-64
No files found.
spec/frontend/pipelines/time_ago_spec.js
0 → 100644
View file @
519bcd2d
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
TimeAgo
from
'
~/pipelines/components/time_ago.vue
'
;
describe
(
'
Timeago component
'
,
()
=>
{
let
wrapper
;
const
createComponent
=
(
props
=
{})
=>
{
wrapper
=
shallowMount
(
TimeAgo
,
{
propsData
:
{
...
props
,
},
data
()
{
return
{
iconTimerSvg
:
`<svg></svg>`
,
};
},
});
};
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
});
describe
(
'
with duration
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
duration
:
10
,
finishedTime
:
''
});
});
it
(
'
should render duration and timer svg
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.duration
'
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
'
.duration svg
'
).
exists
()).
toBe
(
true
);
});
});
describe
(
'
without duration
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
duration
:
0
,
finishedTime
:
''
});
});
it
(
'
should not render duration and timer svg
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.duration
'
).
exists
()).
toBe
(
false
);
});
});
describe
(
'
with finishedTime
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
duration
:
0
,
finishedTime
:
'
2017-04-26T12:40:23.277Z
'
});
});
it
(
'
should render time and calendar icon
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.finished-at
'
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
'
.finished-at i.fa-calendar
'
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
'
.finished-at time
'
).
exists
()).
toBe
(
true
);
});
});
describe
(
'
without finishedTime
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
duration
:
0
,
finishedTime
:
''
});
});
it
(
'
should not render time and calendar icon
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.finished-at
'
).
exists
()).
toBe
(
false
);
});
});
});
spec/javascripts/pipelines/time_ago_spec.js
deleted
100644 → 0
View file @
e70ff61f
import
Vue
from
'
vue
'
;
import
timeAgo
from
'
~/pipelines/components/time_ago.vue
'
;
describe
(
'
Timeago component
'
,
()
=>
{
let
TimeAgo
;
beforeEach
(()
=>
{
TimeAgo
=
Vue
.
extend
(
timeAgo
);
});
describe
(
'
with duration
'
,
()
=>
{
it
(
'
should render duration and timer svg
'
,
()
=>
{
const
component
=
new
TimeAgo
({
propsData
:
{
duration
:
10
,
finishedTime
:
''
,
},
}).
$mount
();
expect
(
component
.
$el
.
querySelector
(
'
.duration
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.duration svg
'
)).
toBeDefined
();
});
});
describe
(
'
without duration
'
,
()
=>
{
it
(
'
should not render duration and timer svg
'
,
()
=>
{
const
component
=
new
TimeAgo
({
propsData
:
{
duration
:
0
,
finishedTime
:
''
,
},
}).
$mount
();
expect
(
component
.
$el
.
querySelector
(
'
.duration
'
)).
toBe
(
null
);
});
});
describe
(
'
with finishedTime
'
,
()
=>
{
it
(
'
should render time and calendar icon
'
,
()
=>
{
const
component
=
new
TimeAgo
({
propsData
:
{
duration
:
0
,
finishedTime
:
'
2017-04-26T12:40:23.277Z
'
,
},
}).
$mount
();
expect
(
component
.
$el
.
querySelector
(
'
.finished-at
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.finished-at i.fa-calendar
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.finished-at time
'
)).
toBeDefined
();
});
});
describe
(
'
without finishedTime
'
,
()
=>
{
it
(
'
should not render time and calendar icon
'
,
()
=>
{
const
component
=
new
TimeAgo
({
propsData
:
{
duration
:
0
,
finishedTime
:
''
,
},
}).
$mount
();
expect
(
component
.
$el
.
querySelector
(
'
.finished-at
'
)).
toBe
(
null
);
});
});
});
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