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
61be1245
Commit
61be1245
authored
Apr 15, 2020
by
Daniel Tian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use shallowMount and .toHaveLength() for tests
parent
2f1250cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
ee/spec/frontend/vue_shared/security_reports/components/event_item_spec.js
...vue_shared/security_reports/components/event_item_spec.js
+1
-1
ee/spec/frontend/vulnerabilities/history_comment_spec.js
ee/spec/frontend/vulnerabilities/history_comment_spec.js
+6
-6
ee/spec/frontend/vulnerabilities/history_entry_spec.js
ee/spec/frontend/vulnerabilities/history_entry_spec.js
+8
-9
No files found.
ee/spec/frontend/vue_shared/security_reports/components/event_item_spec.js
View file @
61be1245
...
...
@@ -48,7 +48,7 @@ describe('Event Item', () => {
expect
(
wrapper
.
props
().
iconClass
).
toBe
(
'
ci-status-icon-success
'
);
});
it
(
'
renders the action buttons
t
ontainer
'
,
()
=>
{
it
(
'
renders the action buttons
c
ontainer
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.action-buttons
'
)).
toExist
();
});
});
...
...
ee/spec/frontend/vulnerabilities/history_comment_spec.js
View file @
61be1245
...
...
@@ -110,7 +110,7 @@ describe('History Comment', () => {
return
axios
.
waitForAll
();
})
.
then
(()
=>
{
expect
(
mockAxios
.
history
.
post
.
length
).
toBe
(
1
);
expect
(
mockAxios
.
history
.
post
).
toHaveLength
(
1
);
expect
(
wrapper
.
emitted
().
onCommentAdded
).
toBeTruthy
();
expect
(
wrapper
.
emitted
().
onCommentAdded
[
0
][
0
]).
toEqual
(
comment
);
});
...
...
@@ -125,7 +125,7 @@ describe('History Comment', () => {
return
axios
.
waitForAll
();
})
.
then
(()
=>
{
expect
(
mockAxios
.
history
.
post
.
length
).
toBe
(
1
);
expect
(
mockAxios
.
history
.
post
).
toHaveLength
(
1
);
expect
(
createFlash
).
toHaveBeenCalledTimes
(
1
);
expect
(
commentEditor
().
exists
()).
toBe
(
true
);
});
...
...
@@ -198,7 +198,7 @@ describe('History Comment', () => {
return
axios
.
waitForAll
();
})
.
then
(()
=>
{
expect
(
mockAxios
.
history
.
delete
.
length
).
toBe
(
1
);
expect
(
mockAxios
.
history
.
delete
).
toHaveLength
(
1
);
expect
(
wrapper
.
emitted
().
onCommentDeleted
).
toBeTruthy
();
expect
(
wrapper
.
emitted
().
onCommentDeleted
[
0
][
0
]).
toEqual
(
comment
);
});
...
...
@@ -215,7 +215,7 @@ describe('History Comment', () => {
return
axios
.
waitForAll
();
})
.
then
(()
=>
{
expect
(
mockAxios
.
history
.
delete
.
length
).
toBe
(
1
);
expect
(
mockAxios
.
history
.
delete
).
toHaveLength
(
1
);
expect
(
createFlash
).
toHaveBeenCalledTimes
(
1
);
});
});
...
...
@@ -234,7 +234,7 @@ describe('History Comment', () => {
return
axios
.
waitForAll
();
})
.
then
(()
=>
{
expect
(
mockAxios
.
history
.
put
.
length
).
toBe
(
1
);
expect
(
mockAxios
.
history
.
put
).
toHaveLength
(
1
);
expect
(
wrapper
.
emitted
().
onCommentUpdated
).
toBeTruthy
();
expect
(
wrapper
.
emitted
().
onCommentUpdated
[
0
][
0
]).
toEqual
(
responseData
);
expect
(
wrapper
.
emitted
().
onCommentUpdated
[
0
][
1
]).
toEqual
(
comment
);
...
...
@@ -250,7 +250,7 @@ describe('History Comment', () => {
return
axios
.
waitForAll
();
})
.
then
(()
=>
{
expect
(
mockAxios
.
history
.
put
.
length
).
toBe
(
1
);
expect
(
mockAxios
.
history
.
put
).
toHaveLength
(
1
);
expect
(
createFlash
).
toHaveBeenCalledTimes
(
1
);
});
});
...
...
ee/spec/frontend/vulnerabilities/history_entry_spec.js
View file @
61be1245
import
{
m
ount
}
from
'
@vue/test-utils
'
;
import
{
shallowM
ount
}
from
'
@vue/test-utils
'
;
import
HistoryEntry
from
'
ee/vulnerabilities/components/history_entry.vue
'
;
import
EventItem
from
'
ee/vue_shared/security_reports/components/event_item.vue
'
;
...
...
@@ -30,10 +30,9 @@ describe('History Entry', () => {
const
createWrapper
=
(...
notes
)
=>
{
const
discussion
=
{
notes
};
wrapper
=
mount
(
HistoryEntry
,
{
propsData
:
{
discussion
,
},
wrapper
=
shallowMount
(
HistoryEntry
,
{
propsData
:
{
discussion
},
stubs
:
{
EventItem
},
});
};
...
...
@@ -66,7 +65,7 @@ describe('History Entry', () => {
createWrapper
(
systemNote
);
expect
(
newComment
().
exists
()).
toBe
(
true
);
expect
(
existingComments
()
.
length
).
toBe
(
0
);
expect
(
existingComments
()
).
toHaveLength
(
0
);
});
it
(
'
displays comments when there are comments
'
,
()
=>
{
...
...
@@ -74,7 +73,7 @@ describe('History Entry', () => {
createWrapper
(
systemNote
,
commentNote
,
commentNoteClone
);
expect
(
newComment
().
exists
()).
toBe
(
false
);
expect
(
existingComments
()
.
length
).
toBe
(
2
);
expect
(
existingComments
()
).
toHaveLength
(
2
);
expect
(
commentAt
(
0
).
props
(
'
comment
'
)).
toEqual
(
commentNote
);
expect
(
commentAt
(
1
).
props
(
'
comment
'
)).
toEqual
(
commentNoteClone
);
});
...
...
@@ -85,7 +84,7 @@ describe('History Entry', () => {
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
newComment
().
exists
()).
toBe
(
false
);
expect
(
existingComments
()
.
length
).
toBe
(
1
);
expect
(
existingComments
()
).
toHaveLength
(
1
);
expect
(
commentAt
(
0
).
props
(
'
comment
'
)).
toEqual
(
commentNote
);
});
});
...
...
@@ -106,7 +105,7 @@ describe('History Entry', () => {
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
newComment
().
exists
()).
toBe
(
true
);
expect
(
existingComments
()
.
length
).
toBe
(
0
);
expect
(
existingComments
()
).
toHaveLength
(
0
);
});
});
});
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