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
4185d9bd
Commit
4185d9bd
authored
Apr 28, 2020
by
Jackie Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate ee codequality_issue_body_spec to Jest
parent
6e5067d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
ee/spec/frontend/vue_mr_widget/components/codequality_issue_body_spec.js
...d/vue_mr_widget/components/codequality_issue_body_spec.js
+62
-0
No files found.
ee/spec/
javascripts
/vue_mr_widget/components/codequality_issue_body_spec.js
→
ee/spec/
frontend
/vue_mr_widget/components/codequality_issue_body_spec.js
View file @
4185d9bd
import
Vue
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
component
from
'
ee/vue_merge_request_widget/components/codequality_issue_body.vue
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
STATUS_FAILED
,
STATUS_NEUTRAL
,
STATUS_SUCCESS
}
from
'
~/reports/constants
'
;
describe
(
'
code quality issue body issue body
'
,
()
=>
{
let
vm
;
let
wrapper
;
const
Component
=
Vue
.
extend
(
component
);
const
codequalityIssue
=
{
name
:
'
rubygem-rest-client: session fixation vulnerability via Set-Cookie headers in 30x redirection responses
'
,
...
...
@@ -15,52 +13,50 @@ describe('code quality issue body issue body', () => {
type
:
'
Issue
'
,
urlPath
:
'
/Gemfile.lock#L22
'
,
};
const
mountWithStatus
=
initialStatus
=>
{
wrapper
=
shallowMount
(
component
,
{
propsData
:
{
issue
:
codequalityIssue
,
status
:
initialStatus
,
},
});
};
afterEach
(()
=>
{
vm
.
$destroy
();
wrapper
.
destroy
();
wrapper
=
null
;
});
describe
(
'
with success
'
,
()
=>
{
it
(
'
renders fixed label
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
issue
:
codequalityIssue
,
status
:
STATUS_SUCCESS
,
});
mountWithStatus
(
STATUS_SUCCESS
);
expect
(
vm
.
$el
.
textContent
.
trim
()).
toContain
(
'
Fixed
'
);
expect
(
wrapper
.
text
()).
toContain
(
'
Fixed
'
);
});
});
describe
(
'
without success
'
,
()
=>
{
it
(
'
renders fixed label
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
issue
:
codequalityIssue
,
status
:
STATUS_FAILED
,
});
mountWithStatus
(
STATUS_FAILED
);
expect
(
vm
.
$el
.
textContent
.
trim
()).
not
.
toContain
(
'
Fixed
'
);
expect
(
wrapper
.
text
()).
not
.
toContain
(
'
Fixed
'
);
});
});
describe
(
'
name
'
,
()
=>
{
it
(
'
renders name
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
issue
:
codequalityIssue
,
status
:
STATUS_NEUTRAL
,
});
mountWithStatus
(
STATUS_NEUTRAL
);
expect
(
vm
.
$el
.
textContent
.
trim
()).
toContain
(
codequalityIssue
.
name
);
expect
(
wrapper
.
text
()).
toContain
(
codequalityIssue
.
name
);
});
});
describe
(
'
path
'
,
()
=>
{
it
(
'
renders name
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
issue
:
codequalityIssue
,
status
:
STATUS_NEUTRAL
,
});
it
(
'
renders the report-link path using the correct code quality issue
'
,
()
=>
{
mountWithStatus
(
STATUS_NEUTRAL
);
expect
(
vm
.
$el
.
querySelector
(
'
a
'
).
getAttribute
(
'
href
'
)).
toEqual
(
codequalityIssue
.
urlPath
);
expect
(
vm
.
$el
.
querySelector
(
'
a
'
).
textContent
.
trim
()).
toEqual
(
codequalityIssue
.
path
);
expect
(
wrapper
.
find
(
'
report-link-stub
'
).
props
(
'
issue
'
)).
toBe
(
codequalityIssue
);
});
});
});
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