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
17651e21
Commit
17651e21
authored
Apr 01, 2020
by
Alexander Turinske
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor security dashboard getter test mocks
- use cleaner implementation
parent
d90a33f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
17 deletions
+7
-17
ee/spec/frontend/security_dashboard/store/modules/filters/actions_spec.js
.../security_dashboard/store/modules/filters/actions_spec.js
+1
-2
ee/spec/frontend/security_dashboard/store/modules/vulnerabilities/getters_spec.js
...y_dashboard/store/modules/vulnerabilities/getters_spec.js
+6
-15
No files found.
ee/spec/frontend/security_dashboard/store/modules/filters/actions_spec.js
View file @
17651e21
...
...
@@ -169,8 +169,7 @@ describe('filters actions', () => {
},
].
forEach
(
testCase
=>
{
it
(
testCase
.
description
,
done
=>
{
const
mockValue
=
testCase
.
returnValue
;
getParameterValues
.
mockImplementation
(()
=>
mockValue
);
getParameterValues
.
mockReturnValue
(
testCase
.
returnValue
);
const
state
=
createState
();
testAction
(
actions
.
setHideDismissedToggleInitialState
,
...
...
ee/spec/frontend/security_dashboard/store/modules/vulnerabilities/getters_spec.js
View file @
17651e21
...
...
@@ -65,26 +65,17 @@ describe('vulnerabilities module getters', () => {
getters
.
getVulnerabilityHistoryByName
(
state
)(
name
);
return
{
getVulnerabilityHistoryByName
};
};
const
realDate
=
Date
;
beforeEach
(()
=>
{
state
=
createState
();
state
.
vulnerabilitiesHistory
=
mockHistoryData
;
jest
.
useFakeTimers
();
const
currentDate
=
new
Date
(
2019
,
1
,
2
);
global
.
Date
=
class
extends
Date
{
constructor
(
date
)
{
if
(
date
)
{
// eslint-disable-next-line constructor-super
return
super
(
date
);
}
return
currentDate
;
}
};
});
afterEach
(()
=>
{
global
.
Date
=
realDate
;
const
mockDate
=
new
Date
(
2019
,
1
,
2
);
const
originalDate
=
Date
;
jest
.
spyOn
(
global
,
'
Date
'
).
mockImplementation
(()
=>
mockDate
);
global
.
Date
.
now
=
originalDate
.
now
;
global
.
Date
.
parse
=
originalDate
.
parse
;
global
.
Date
.
UTC
=
originalDate
.
UTC
;
});
it
(
'
should filter the data to the last 30 days and days we have data for
'
,
()
=>
{
...
...
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