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
5673ea8e
Commit
5673ea8e
authored
Jun 29, 2021
by
Paul Gascou-Vaillancourt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assert policies rendering against fully mounted table
parent
e0a79b85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
28 deletions
+21
-28
ee/spec/frontend/threat_monitoring/components/policy_list_spec.js
...frontend/threat_monitoring/components/policy_list_spec.js
+21
-28
No files found.
ee/spec/frontend/threat_monitoring/components/policy_list_spec.js
View file @
5673ea8e
import
{
GlTable
,
GlDrawer
}
from
'
@gitlab/ui
'
;
import
{
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
merge
,
cloneDeep
}
from
'
lodash
'
;
import
{
merge
}
from
'
lodash
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
PolicyList
from
'
ee/threat_monitoring/components/policy_list.vue
'
;
import
networkPoliciesQuery
from
'
ee/threat_monitoring/graphql/queries/network_policies.query.graphql
'
;
import
scanExecutionPoliciesQuery
from
'
ee/threat_monitoring/graphql/queries/scan_execution_policies.query.graphql
'
;
import
createStore
from
'
ee/threat_monitoring/store
'
;
import
createMockApolloProvider
from
'
helpers/mock_apollo_helper
'
;
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
import
{
mountExtended
,
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
{
networkPolicies
,
scanExecutionPolicies
}
from
'
../mocks/mock_apollo
'
;
import
{
mockNetworkPoliciesResponse
,
mockScanExecutionPoliciesResponse
}
from
'
../mocks/mock_data
'
;
...
...
@@ -137,33 +137,26 @@ describe('PolicyList component', () => {
});
describe
(
'
given policies have been fetched
'
,
()
=>
{
beforeEach
(()
=>
{
mountShallowWrapper
({
stubs
:
{
GlTable
:
stubComponent
(
GlTable
,
{
template
:
'
<table data-testid="table" />
'
,
props
:
[
'
items
'
],
}),
},
});
});
let
rows
;
it
(
'
passes all policies to the table
'
,
()
=>
{
expect
(
cloneDeep
(
wrapper
.
findByTestId
(
'
table
'
).
props
(
'
items
'
))).
toEqual
([
expect
.
objectContaining
({
name
:
mockNetworkPoliciesResponse
[
0
].
name
,
}),
expect
.
objectContaining
({
name
:
'
drop-outbound
'
,
}),
expect
.
objectContaining
({
name
:
'
allow-inbound-http
'
,
}),
expect
.
objectContaining
({
name
:
mockScanExecutionPoliciesResponse
[
0
].
name
,
}),
]);
});
beforeEach
(
async
()
=>
{
mountWrapper
();
await
waitForPromises
();
rows
=
wrapper
.
findAll
(
'
tr
'
);
});
it
.
each
`
rowIndex | expectedPolicyName
${
1
}
|
${
mockNetworkPoliciesResponse
[
0
].
name
}
${
2
}
|
${
'
drop-outbound
'
}
${
3
}
|
${
'
allow-inbound-http
'
}
${
4
}
|
${
mockScanExecutionPoliciesResponse
[
0
].
name
}
`
(
'
renders "$expectedPolicyName" policy in row #$rowIndex
'
,
({
expectedPolicyName
,
rowIndex
})
=>
{
expect
(
rows
.
at
(
rowIndex
).
text
()).
toContain
(
expectedPolicyName
);
},
);
});
describe
(
'
with allEnvironments enabled
'
,
()
=>
{
...
...
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