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
40b5f69a
Commit
40b5f69a
authored
Jan 20, 2022
by
Illya Klymov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace usage of find/findAll in ee/spec/frontend/vulnerabilities
* migrate to proper use of findComponent/findAllComponents
parent
68755b38
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
34 additions
and
34 deletions
+34
-34
ee/spec/frontend/vulnerabilities/footer_spec.js
ee/spec/frontend/vulnerabilities/footer_spec.js
+4
-4
ee/spec/frontend/vulnerabilities/header_spec.js
ee/spec/frontend/vulnerabilities/header_spec.js
+8
-8
ee/spec/frontend/vulnerabilities/history_comment_editor_spec.js
...c/frontend/vulnerabilities/history_comment_editor_spec.js
+3
-3
ee/spec/frontend/vulnerabilities/history_comment_spec.js
ee/spec/frontend/vulnerabilities/history_comment_spec.js
+3
-3
ee/spec/frontend/vulnerabilities/related_issues_spec.js
ee/spec/frontend/vulnerabilities/related_issues_spec.js
+2
-2
ee/spec/frontend/vulnerabilities/remediated_badge_spec.js
ee/spec/frontend/vulnerabilities/remediated_badge_spec.js
+3
-3
ee/spec/frontend/vulnerabilities/resolution_alert_spec.js
ee/spec/frontend/vulnerabilities/resolution_alert_spec.js
+1
-1
ee/spec/frontend/vulnerabilities/status_description_spec.js
ee/spec/frontend/vulnerabilities/status_description_spec.js
+5
-5
ee/spec/frontend/vulnerabilities/vulnerability_details_spec.js
...ec/frontend/vulnerabilities/vulnerability_details_spec.js
+2
-2
ee/spec/frontend/vulnerabilities/vulnerability_state_dropdown_spec.js
...tend/vulnerabilities/vulnerability_state_dropdown_spec.js
+3
-3
No files found.
ee/spec/frontend/vulnerabilities/footer_spec.js
View file @
40b5f69a
...
...
@@ -226,8 +226,8 @@ describe('Vulnerability Footer', () => {
const
properties
=
{
remediations
:
[{
diff
:
[{}]
}],
solution
:
'
some solution
'
};
createWrapper
({
properties
,
discussionsHandler
:
discussionsHandler
({
discussions
:
[]
})
});
expect
(
wrapper
.
find
(
SolutionCard
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
SolutionCard
).
props
()).
toEqual
({
expect
(
wrapper
.
find
Component
(
SolutionCard
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
SolutionCard
).
props
()).
toEqual
({
solution
:
properties
.
solution
,
remediation
:
properties
.
remediations
[
0
],
hasDownload
:
true
,
...
...
@@ -237,7 +237,7 @@ describe('Vulnerability Footer', () => {
it
(
'
does not show solution card when there is not one
'
,
()
=>
{
createWrapper
();
expect
(
wrapper
.
find
(
SolutionCard
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
Component
(
SolutionCard
).
exists
()).
toBe
(
false
);
});
});
...
...
@@ -305,7 +305,7 @@ describe('Vulnerability Footer', () => {
describe
(
'
detection note
'
,
()
=>
{
const
detectionNote
=
()
=>
wrapper
.
find
(
'
[data-testid="detection-note"]
'
);
const
statusDescription
=
()
=>
wrapper
.
find
(
StatusDescription
);
const
statusDescription
=
()
=>
wrapper
.
find
Component
(
StatusDescription
);
const
vulnerabilityStates
=
Object
.
keys
(
VULNERABILITY_STATES
);
it
.
each
(
vulnerabilityStates
)(
...
...
ee/spec/frontend/vulnerabilities/header_spec.js
View file @
40b5f69a
...
...
@@ -82,11 +82,11 @@ describe('Vulnerability Header', () => {
return
user
;
};
const
findGlButton
=
()
=>
wrapper
.
find
(
GlButton
);
const
findSplitButton
=
()
=>
wrapper
.
find
(
SplitButton
);
const
findBadge
=
()
=>
wrapper
.
find
(
GlBadge
);
const
findResolutionAlert
=
()
=>
wrapper
.
find
(
ResolutionAlert
);
const
findStatusDescription
=
()
=>
wrapper
.
find
(
StatusDescription
);
const
findGlButton
=
()
=>
wrapper
.
find
Component
(
GlButton
);
const
findSplitButton
=
()
=>
wrapper
.
find
Component
(
SplitButton
);
const
findBadge
=
()
=>
wrapper
.
find
Component
(
GlBadge
);
const
findResolutionAlert
=
()
=>
wrapper
.
find
Component
(
ResolutionAlert
);
const
findStatusDescription
=
()
=>
wrapper
.
find
Component
(
StatusDescription
);
const
createWrapper
=
({
vulnerability
=
{},
apolloProvider
})
=>
{
wrapper
=
shallowMount
(
Header
,
{
...
...
@@ -139,7 +139,7 @@ describe('Vulnerability Header', () => {
});
it
(
`emits the updated vulnerability properly -
${
action
}
`
,
async
()
=>
{
const
dropdown
=
wrapper
.
find
(
VulnerabilityStateDropdown
);
const
dropdown
=
wrapper
.
find
Component
(
VulnerabilityStateDropdown
);
dropdown
.
vm
.
$emit
(
'
change
'
,
{
action
});
await
waitForPromises
();
...
...
@@ -149,7 +149,7 @@ describe('Vulnerability Header', () => {
});
it
(
`emits an event when the state is changed -
${
action
}
`
,
async
()
=>
{
const
dropdown
=
wrapper
.
find
(
VulnerabilityStateDropdown
);
const
dropdown
=
wrapper
.
find
Component
(
VulnerabilityStateDropdown
);
dropdown
.
vm
.
$emit
(
'
change
'
,
{
action
});
await
waitForPromises
();
...
...
@@ -175,7 +175,7 @@ describe('Vulnerability Header', () => {
});
it
(
'
when the vulnerability state changes but the API call fails, an error message is displayed
'
,
async
()
=>
{
const
dropdown
=
wrapper
.
find
(
VulnerabilityStateDropdown
);
const
dropdown
=
wrapper
.
find
Component
(
VulnerabilityStateDropdown
);
dropdown
.
vm
.
$emit
(
'
change
'
,
{
action
});
await
waitForPromises
();
...
...
ee/spec/frontend/vulnerabilities/history_comment_editor_spec.js
View file @
40b5f69a
...
...
@@ -11,9 +11,9 @@ describe('History Comment Editor', () => {
});
};
const
textarea
=
()
=>
wrapper
.
find
(
GlFormTextarea
);
const
saveButton
=
()
=>
wrapper
.
find
({
ref
:
'
saveButton
'
});
const
cancelButton
=
()
=>
wrapper
.
find
({
ref
:
'
cancelButton
'
});
const
textarea
=
()
=>
wrapper
.
find
Component
(
GlFormTextarea
);
const
saveButton
=
()
=>
wrapper
.
find
Component
({
ref
:
'
saveButton
'
});
const
cancelButton
=
()
=>
wrapper
.
find
Component
({
ref
:
'
cancelButton
'
});
afterEach
(()
=>
wrapper
.
destroy
());
...
...
ee/spec/frontend/vulnerabilities/history_comment_spec.js
View file @
40b5f69a
...
...
@@ -74,13 +74,13 @@ describe('History Comment', () => {
.
mockResolvedValue
(
createMutationResponse
({
queryName
:
UPDATE_NOTE
,
note
}));
});
const
addCommentButton
=
()
=>
wrapper
.
find
({
ref
:
'
addCommentButton
'
});
const
addCommentButton
=
()
=>
wrapper
.
find
Component
({
ref
:
'
addCommentButton
'
});
const
commentEditor
=
()
=>
wrapper
.
findComponent
(
HistoryCommentEditor
);
const
eventItem
=
()
=>
wrapper
.
findComponent
(
EventItem
);
const
editButton
=
()
=>
wrapper
.
find
(
'
[title="Edit Comment"]
'
);
const
deleteButton
=
()
=>
wrapper
.
find
(
'
[title="Delete Comment"]
'
);
const
confirmDeleteButton
=
()
=>
wrapper
.
find
({
ref
:
'
confirmDeleteButton
'
});
const
cancelDeleteButton
=
()
=>
wrapper
.
find
({
ref
:
'
cancelDeleteButton
'
});
const
confirmDeleteButton
=
()
=>
wrapper
.
find
Component
({
ref
:
'
confirmDeleteButton
'
});
const
cancelDeleteButton
=
()
=>
wrapper
.
find
Component
({
ref
:
'
cancelDeleteButton
'
});
// Check that the passed-in elements exist, and that everything else does not exist.
const
expectExists
=
(...
expectedElements
)
=>
{
...
...
ee/spec/frontend/vulnerabilities/related_issues_spec.js
View file @
40b5f69a
...
...
@@ -53,10 +53,10 @@ describe('Vulnerability related issues component', () => {
}
};
const
relatedIssuesBlock
=
()
=>
wrapper
.
find
(
RelatedIssuesBlock
);
const
relatedIssuesBlock
=
()
=>
wrapper
.
find
Component
(
RelatedIssuesBlock
);
const
blockProp
=
(
prop
)
=>
relatedIssuesBlock
().
props
(
prop
);
const
blockEmit
=
(
eventName
,
data
)
=>
relatedIssuesBlock
().
vm
.
$emit
(
eventName
,
data
);
const
findCreateIssueButton
=
()
=>
wrapper
.
find
({
ref
:
'
createIssue
'
});
const
findCreateIssueButton
=
()
=>
wrapper
.
find
Component
({
ref
:
'
createIssue
'
});
afterEach
(()
=>
{
wrapper
.
destroy
();
...
...
ee/spec/frontend/vulnerabilities/remediated_badge_spec.js
View file @
40b5f69a
...
...
@@ -9,7 +9,7 @@ const POPOVER_CONTENT =
describe
(
'
Remediated badge component
'
,
()
=>
{
let
wrapper
;
const
findBadge
=
()
=>
wrapper
.
find
(
GlBadge
);
const
findBadge
=
()
=>
wrapper
.
find
Component
(
GlBadge
);
const
createWrapper
=
()
=>
{
return
shallowMount
(
RemediatedBadge
);
...
...
@@ -26,12 +26,12 @@ describe('Remediated badge component', () => {
});
it
(
'
should link the badge and the popover
'
,
()
=>
{
const
popover
=
wrapper
.
find
({
ref
:
'
popover
'
});
const
popover
=
wrapper
.
find
Component
({
ref
:
'
popover
'
});
expect
(
popover
.
props
(
'
target
'
)()).
toEqual
(
findBadge
().
element
);
});
it
(
'
should pass down the data to the popover
'
,
()
=>
{
const
popoverAttributes
=
wrapper
.
find
(
GlPopover
).
attributes
();
const
popoverAttributes
=
wrapper
.
find
Component
(
GlPopover
).
attributes
();
expect
(
popoverAttributes
.
title
).
toEqual
(
POPOVER_TITLE
);
expect
(
popoverAttributes
.
content
).
toEqual
(
POPOVER_CONTENT
);
...
...
ee/spec/frontend/vulnerabilities/resolution_alert_spec.js
View file @
40b5f69a
...
...
@@ -12,7 +12,7 @@ describe('Vulnerability list component', () => {
wrapper
=
shallowMount
(
ResolutionAlert
,
options
);
};
const
findAlert
=
()
=>
wrapper
.
find
(
GlAlert
);
const
findAlert
=
()
=>
wrapper
.
find
Component
(
GlAlert
);
afterEach
(()
=>
{
wrapper
.
destroy
();
...
...
ee/spec/frontend/vulnerabilities/status_description_spec.js
View file @
40b5f69a
...
...
@@ -22,11 +22,11 @@ describe('Vulnerability status description component', () => {
wrapper
.
destroy
();
});
const
timeAgo
=
()
=>
wrapper
.
find
(
TimeAgoTooltip
);
const
pipelineLink
=
()
=>
wrapper
.
find
(
GlLink
);
const
userAvatar
=
()
=>
wrapper
.
find
(
UserAvatarLink
);
const
userLoadingIcon
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
const
skeletonLoader
=
()
=>
wrapper
.
find
(
GlSkeletonLoading
);
const
timeAgo
=
()
=>
wrapper
.
find
Component
(
TimeAgoTooltip
);
const
pipelineLink
=
()
=>
wrapper
.
find
Component
(
GlLink
);
const
userAvatar
=
()
=>
wrapper
.
find
Component
(
UserAvatarLink
);
const
userLoadingIcon
=
()
=>
wrapper
.
find
Component
(
GlLoadingIcon
);
const
skeletonLoader
=
()
=>
wrapper
.
find
Component
(
GlSkeletonLoading
);
const
statusEl
=
()
=>
wrapper
.
find
(
'
[data-testid="status"]
'
);
// Create a date using the passed-in string, or just use the current time if nothing was passed in.
...
...
ee/spec/frontend/vulnerabilities/vulnerability_details_spec.js
View file @
40b5f69a
...
...
@@ -38,7 +38,7 @@ describe('Vulnerability Details', () => {
it
(
'
shows the properties that should always be shown
'
,
()
=>
{
createWrapper
();
expect
(
getById
(
'
description
'
).
html
()).
toContain
(
vulnerability
.
descriptionHtml
);
expect
(
wrapper
.
find
(
SeverityBadge
).
props
(
'
severity
'
)).
toBe
(
vulnerability
.
severity
);
expect
(
wrapper
.
find
Component
(
SeverityBadge
).
props
(
'
severity
'
)).
toBe
(
vulnerability
.
severity
);
expect
(
getText
(
'
reportType
'
)).
toBe
(
`Tool:
${
vulnerability
.
reportType
}
`
);
expect
(
getById
(
'
title
'
).
exists
()).
toBe
(
false
);
...
...
@@ -202,7 +202,7 @@ describe('Vulnerability Details', () => {
});
describe
(
'
file link
'
,
()
=>
{
const
file
=
()
=>
getById
(
'
file
'
).
find
(
GlLink
);
const
file
=
()
=>
getById
(
'
file
'
).
find
Component
(
GlLink
);
it
(
'
shows only the file name if there is no start line
'
,
()
=>
{
createWrapper
({
location
:
{
file
:
'
test.txt
'
,
blobPath
:
'
blob_path.txt
'
}
});
...
...
ee/spec/frontend/vulnerabilities/vulnerability_state_dropdown_spec.js
View file @
40b5f69a
...
...
@@ -24,9 +24,9 @@ describe('Vulnerability state dropdown component', () => {
const
dropdownItems
=
()
=>
wrapper
.
findAll
(
'
.dropdown-item
'
);
const
firstUnselectedItem
=
()
=>
wrapper
.
find
(
'
.dropdown-item:not(.selected)
'
);
const
selectedItem
=
()
=>
wrapper
.
find
(
'
.dropdown-item.selected
'
);
const
saveButton
=
()
=>
wrapper
.
find
({
ref
:
'
save-button
'
});
const
cancelButton
=
()
=>
wrapper
.
find
({
ref
:
'
cancel-button
'
});
const
innerDropdown
=
()
=>
wrapper
.
find
({
ref
:
'
dropdown
'
});
const
saveButton
=
()
=>
wrapper
.
find
Component
({
ref
:
'
save-button
'
});
const
cancelButton
=
()
=>
wrapper
.
find
Component
({
ref
:
'
cancel-button
'
});
const
innerDropdown
=
()
=>
wrapper
.
find
Component
({
ref
:
'
dropdown
'
});
const
dropdownItemFor
=
(
state
)
=>
wrapper
.
findByTestId
(
state
);
afterEach
(()
=>
wrapper
.
destroy
());
...
...
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