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
e6573cb3
Commit
e6573cb3
authored
Jun 29, 2021
by
Paul Gascou-Vaillancourt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make mocks more consistent
parent
5490a663
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
ee/spec/frontend/threat_monitoring/components/policy_drawer/policy_drawer_spec.js
...monitoring/components/policy_drawer/policy_drawer_spec.js
+2
-2
ee/spec/frontend/threat_monitoring/components/policy_list_spec.js
...frontend/threat_monitoring/components/policy_list_spec.js
+7
-7
ee/spec/frontend/threat_monitoring/mocks/mock_data.js
ee/spec/frontend/threat_monitoring/mocks/mock_data.js
+3
-1
No files found.
ee/spec/frontend/threat_monitoring/components/policy_drawer/policy_drawer_spec.js
View file @
e6573cb3
...
...
@@ -3,12 +3,12 @@ import PolicyDrawer from 'ee/threat_monitoring/components/policy_drawer/policy_d
import
ScanExecutionPolicy
from
'
ee/threat_monitoring/components/policy_drawer/scan_execution_policy.vue
'
;
import
{
mountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
mockPoliciesResponse
,
mock
Network
PoliciesResponse
,
mockCiliumPolicy
,
mockScanExecutionPolicy
,
}
from
'
../../mocks/mock_data
'
;
const
[
mockGenericPolicy
]
=
mockPoliciesResponse
;
const
[
mockGenericPolicy
]
=
mock
Network
PoliciesResponse
;
describe
(
'
PolicyDrawer component
'
,
()
=>
{
let
wrapper
;
...
...
ee/spec/frontend/threat_monitoring/components/policy_list_spec.js
View file @
e6573cb3
...
...
@@ -10,7 +10,7 @@ import createMockApolloProvider from 'helpers/mock_apollo_helper';
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
import
{
mountExtended
,
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
networkPolicies
,
scanExecutionPolicies
}
from
'
../mocks/mock_apollo
'
;
import
{
mock
PoliciesResponse
,
mockScanExecutionPolicy
}
from
'
../mocks/mock_data
'
;
import
{
mock
NetworkPoliciesResponse
,
mockScanExecutionPoliciesResponse
}
from
'
../mocks/mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueApollo
);
...
...
@@ -23,8 +23,8 @@ const environments = [
},
];
const
defaultRequestHandlers
=
{
networkPolicies
:
networkPolicies
(
mockPoliciesResponse
),
scanExecutionPolicies
:
scanExecutionPolicies
(
[
mockScanExecutionPolicy
]
),
networkPolicies
:
networkPolicies
(
mock
Network
PoliciesResponse
),
scanExecutionPolicies
:
scanExecutionPolicies
(
mockScanExecutionPoliciesResponse
),
};
const
pendingHandler
=
jest
.
fn
(()
=>
new
Promise
(()
=>
{}));
...
...
@@ -152,7 +152,7 @@ describe('PolicyList component', () => {
it
(
'
passes all policies to the table
'
,
()
=>
{
expect
(
cloneDeep
(
wrapper
.
findByTestId
(
'
table
'
).
props
(
'
items
'
))).
toEqual
([
expect
.
objectContaining
({
name
:
mockPoliciesResponse
[
0
].
name
,
name
:
mock
Network
PoliciesResponse
[
0
].
name
,
}),
expect
.
objectContaining
({
name
:
'
drop-outbound
'
,
...
...
@@ -161,7 +161,7 @@ describe('PolicyList component', () => {
name
:
'
allow-inbound-http
'
,
}),
expect
.
objectContaining
({
name
:
mockScanExecutionPolic
y
.
name
,
name
:
mockScanExecutionPolic
iesResponse
[
0
]
.
name
,
}),
]);
});
...
...
@@ -182,7 +182,7 @@ describe('PolicyList component', () => {
describe
(
'
given there is a selected policy
'
,
()
=>
{
beforeEach
(()
=>
{
mountShallowWrapper
();
findPoliciesTable
().
vm
.
$emit
(
'
row-selected
'
,
[
mockPoliciesResponse
[
0
]]);
findPoliciesTable
().
vm
.
$emit
(
'
row-selected
'
,
[
mock
Network
PoliciesResponse
[
0
]]);
});
it
(
'
renders opened editor drawer
'
,
()
=>
{
...
...
@@ -195,7 +195,7 @@ describe('PolicyList component', () => {
describe
(
'
given an autodevops policy
'
,
()
=>
{
beforeEach
(()
=>
{
const
autoDevOpsPolicy
=
{
...
mockPoliciesResponse
[
0
],
...
mock
Network
PoliciesResponse
[
0
],
name
:
'
auto-devops
'
,
fromAutoDevops
:
true
,
};
...
...
ee/spec/frontend/threat_monitoring/mocks/mock_data.js
View file @
e6573cb3
...
...
@@ -15,7 +15,7 @@ export const mockEnvironmentsResponse = {
stopped_count
:
5
,
};
export
const
mockPoliciesResponse
=
[
export
const
mock
Network
PoliciesResponse
=
[
{
name
:
'
policy
'
,
yaml
:
`---
...
...
@@ -71,6 +71,8 @@ actions:
enabled
:
true
,
};
export
const
mockScanExecutionPoliciesResponse
=
[
mockScanExecutionPolicy
];
export
const
mockNominalHistory
=
[
[
'
2019-12-04T00:00:00.000Z
'
,
56
],
[
'
2019-12-05T00:00:00.000Z
'
,
2647
],
...
...
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