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
5001ca25
Commit
5001ca25
authored
May 26, 2021
by
Justin Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use full state for setting isInheriting
Instead of using a mock for computed props
parent
ef9ed59d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
ee/spec/frontend/integrations/edit/components/jira_issue_creation_vulnerabilities_spec.js
...it/components/jira_issue_creation_vulnerabilities_spec.js
+7
-10
spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
...d/integrations/edit/components/jira_issues_fields_spec.js
+12
-3
No files found.
ee/spec/frontend/integrations/edit/components/jira_issue_creation_vulnerabilities_spec.js
View file @
5001ca25
...
...
@@ -23,13 +23,14 @@ describe('JiraIssuesFields', () => {
];
const
createComponent
=
(
mountFn
)
=>
({
isInheriting
=
false
,
props
}
=
{})
=>
{
store
=
createStore
({
defaultState
:
isInheriting
?
{}
:
undefined
,
});
return
extendedWrapper
(
mountFn
(
JiraIssueCreationVulnerabilities
,
{
store
,
propsData
:
{
...
defaultProps
,
...
props
},
computed
:
{
isInheriting
:
()
=>
isInheriting
,
},
}),
);
};
...
...
@@ -48,10 +49,6 @@ describe('JiraIssuesFields', () => {
const
setEnableJiraVulnerabilitiesChecked
=
(
isChecked
)
=>
findEnableJiraVulnerabilities
().
vm
.
$emit
(
'
input
'
,
isChecked
);
beforeEach
(()
=>
{
store
=
createStore
();
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
...
...
@@ -145,8 +142,8 @@ describe('JiraIssuesFields', () => {
describe
(
'
with Jira issues fetching in progress
'
,
()
=>
{
beforeEach
(
async
()
=>
{
store
.
state
.
isLoadingJiraIssueTypes
=
true
;
wrapper
=
createShallowComponent
();
store
.
state
.
isLoadingJiraIssueTypes
=
true
;
await
setEnableJiraVulnerabilitiesChecked
(
true
);
});
...
...
@@ -160,8 +157,8 @@ describe('JiraIssuesFields', () => {
describe
(
'
with Jira issues fetched
'
,
()
=>
{
beforeEach
(
async
()
=>
{
store
.
state
.
jiraIssueTypes
=
TEST_JIRA_ISSUE_TYPES
;
wrapper
=
createShallowComponent
({
props
:
{
projectKey
:
'
TES
'
}
});
store
.
state
.
jiraIssueTypes
=
TEST_JIRA_ISSUE_TYPES
;
await
setEnableJiraVulnerabilitiesChecked
(
true
);
});
...
...
@@ -186,8 +183,8 @@ describe('JiraIssuesFields', () => {
describe
(
'
with Jira issue fetch failure
'
,
()
=>
{
beforeEach
(
async
()
=>
{
store
.
state
.
loadingJiraIssueTypesErrorMessage
=
'
something went wrong
'
;
wrapper
=
createShallowComponent
();
store
.
state
.
loadingJiraIssueTypesErrorMessage
=
'
something went wrong
'
;
await
setEnableJiraVulnerabilitiesChecked
(
true
);
});
...
...
spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
View file @
5001ca25
...
...
@@ -3,8 +3,10 @@ import { mount } from '@vue/test-utils';
import
JiraIssuesFields
from
'
~/integrations/edit/components/jira_issues_fields.vue
'
;
import
JiraUpgradeCta
from
'
~/integrations/edit/components/jira_upgrade_cta.vue
'
;
import
eventHub
from
'
~/integrations/edit/event_hub
'
;
import
{
createStore
}
from
'
~/integrations/edit/store
'
;
describe
(
'
JiraIssuesFields
'
,
()
=>
{
let
store
;
let
wrapper
;
const
defaultProps
=
{
...
...
@@ -14,8 +16,13 @@ describe('JiraIssuesFields', () => {
};
const
createComponent
=
({
isInheriting
=
false
,
props
,
...
options
}
=
{})
=>
{
store
=
createStore
({
defaultState
:
isInheriting
?
{}
:
undefined
,
});
wrapper
=
mount
(
JiraIssuesFields
,
{
propsData
:
{
...
defaultProps
,
...
props
},
store
,
stubs
:
[
'
jira-issue-creation-vulnerabilities
'
],
computed
:
{
isInheriting
:
()
=>
isInheriting
,
...
...
@@ -87,9 +94,11 @@ describe('JiraIssuesFields', () => {
});
it
(
'
renders disabled project_key input
'
,
()
=>
{
expect
(
findProjectKey
().
exists
()).
toBe
(
true
);
expect
(
findProjectKey
().
attributes
(
'
disabled
'
)).
toBe
(
'
disabled
'
);
expect
(
findProjectKey
().
attributes
(
'
required
'
)).
toBeUndefined
();
const
projectKey
=
findProjectKey
();
expect
(
projectKey
.
exists
()).
toBe
(
true
);
expect
(
projectKey
.
attributes
(
'
disabled
'
)).
toBe
(
'
disabled
'
);
expect
(
projectKey
.
attributes
(
'
required
'
)).
toBeUndefined
();
});
it
(
'
does not show upgrade banner
'
,
()
=>
{
...
...
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