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
efe339b3
Commit
efe339b3
authored
Nov 21, 2019
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate erased block spec to VTU
parent
b0836565
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
spec/frontend/jobs/components/erased_block_spec.js
spec/frontend/jobs/components/erased_block_spec.js
+21
-14
No files found.
spec/frontend/jobs/components/erased_block_spec.js
View file @
efe339b3
import
Vue
from
'
vue
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
GlLink
}
from
'
@gitlab/ui
'
;
import
{
getTimeago
}
from
'
~/lib/utils/datetime_utility
'
;
import
component
from
'
~/jobs/components/erased_block.vue
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
import
ErasedBlock
from
'
~/jobs/components/erased_block.vue
'
;
describe
(
'
Erased block
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
component
);
let
vm
;
let
wrapper
;
const
erasedAt
=
'
2016-11-07T11:11:16.525Z
'
;
const
timeago
=
getTimeago
();
const
formatedDate
=
timeago
.
format
(
erasedAt
);
const
createComponent
=
props
=>
{
wrapper
=
mount
(
ErasedBlock
,
{
propsData
:
props
,
sync
:
false
,
attachToDocument
:
true
,
});
};
afterEach
(()
=>
{
vm
.
$
destroy
();
wrapper
.
destroy
();
});
describe
(
'
with job erased by user
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
{
createComponent
(
{
user
:
{
username
:
'
root
'
,
web_url
:
'
gitlab.com/root
'
,
...
...
@@ -27,30 +34,30 @@ describe('Erased block', () => {
});
it
(
'
renders username and link
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
a
'
).
getAttribute
(
'
href
'
)).
toEqual
(
'
gitlab.com/root
'
);
expect
(
wrapper
.
find
(
GlLink
).
attributes
(
'
href
'
)).
toEqual
(
'
gitlab.com/root
'
);
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
Job has been erased by
'
);
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
root
'
);
expect
(
wrapper
.
text
().
trim
()
).
toContain
(
'
Job has been erased by
'
);
expect
(
wrapper
.
text
().
trim
()
).
toContain
(
'
root
'
);
});
it
(
'
renders erasedAt
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
formatedDate
);
expect
(
wrapper
.
text
().
trim
()
).
toContain
(
formatedDate
);
});
});
describe
(
'
with erased job
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
{
createComponent
(
{
erasedAt
,
});
});
it
(
'
renders username and link
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
Job has been erased
'
);
expect
(
wrapper
.
text
().
trim
()
).
toContain
(
'
Job has been erased
'
);
});
it
(
'
renders erasedAt
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
formatedDate
);
expect
(
wrapper
.
text
().
trim
()
).
toContain
(
formatedDate
);
});
});
});
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