diff options
author | 2022-02-03 09:08:47 +0000 | |
---|---|---|
committer | 2022-02-04 11:02:15 +0000 | |
commit | c3ee2020d0bfd48c9b2a687d0f80e67190edb5d4 (patch) | |
tree | 076a5f672e62d696e468f888ae61b549688a6824 /gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__ | |
parent | d211be2cbad3ae4dea9dc90dcac80cccd9a510ab (diff) |
Added Policy Jest Tests
Added more tests to increase overall coverage
Issue-ID: POLICY-3899
Change-Id: I97e7954d42199145948f2ac2738a0ceaa7e6a44f
Signed-off-by: brunomilitzer <bruno.militzer@est.tech>
Diffstat (limited to 'gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__')
3 files changed, 701 insertions, 0 deletions
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap new file mode 100644 index 0000000..8d14fa4 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify PoliciesTreeViewer renders correctly 1`] = ` +<WithStyles(ForwardRef(TreeView)) + defaultCollapseIcon={<Memo />} + defaultEndIcon={<Memo />} + defaultExpandIcon={<Memo />} + defaultExpanded={ + Array [ + "root", + ] + } + multiSelect={true} + onNodeSelect={[Function]} +> + <WithStyles(ForwardRef(TreeItem)) + key="1" + label="ROOT(0)" + nodeId={1} + onNodeSelect={[Function]} + /> +</WithStyles(ForwardRef(TreeView))> +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap new file mode 100644 index 0000000..10a5559 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify PolicyToscaFileSelector renders correctly 1`] = ` +<Styled(Modal) + backdrop="static" + keyboard={false} + onHide={[Function]} + size="lg" +> + <ModalHeader + closeButton={true} + closeLabel="Close" + > + <ModalTitle> + Create New Policy Tosca Model + </ModalTitle> + </ModalHeader> + <ModalBody> + <FormGroup + as={ + Object { + "$$typeof": Symbol(react.forward_ref), + "defaultProps": Object { + "noGutters": false, + }, + "render": [Function], + } + } + controlId="formPlaintextEmail" + > + <Col + sm="10" + > + <input + accept=".yaml,.yml" + id="fileUploadButton" + multiple={true} + onChange={[Function]} + style={ + Object { + "display": "none", + } + } + type="file" + /> + <label + htmlFor="fileUploadButton" + > + <WithStyles(ForwardRef(Button)) + color="primary" + component="span" + startIcon={ + <WithStyles(ForwardRef(SvgIcon)) + fontSize="small" + > + <Memo /> + </WithStyles(ForwardRef(SvgIcon))> + } + variant="contained" + > + Upload Files + </WithStyles(ForwardRef(Button))> + <p> + (Only YAML files are supported) + </p> + </label> + <styled.div /> + </Col> + </FormGroup> + </ModalBody> + <ModalFooter> + <WithStyles(ForwardRef(Button)) + onClick={[Function]} + variant="secondary" + > + Close + </WithStyles(ForwardRef(Button))> + </ModalFooter> +</Styled(Modal)> +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap new file mode 100644 index 0000000..24b631b --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap @@ -0,0 +1,598 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify ViewAllPolicies renders correctly 1`] = ` +<Fragment> + <Styled(Modal) + backdrop="static" + keyboard={false} + onHide={[Function]} + show={true} + size="xl" + > + <ModalHeader + closeButton={true} + closeLabel="Close" + /> + <Tabs + id="controlled-tab-example" + mountOnEnter={false} + onSelect={[Function]} + unmountOnExit={false} + variant="tabs" + > + <Tab + eventKey="policies" + title="Policies in Policy Framework" + > + <ModalBody> + <div> + <styled.div> + <PoliciesTreeViewer + policiesData={Array []} + policiesFilterFunction={[Function]} + valueForTreeCreation="name" + /> + </styled.div> + <styled.div> + <WithStyles(Component) + actions={ + Array [ + Object { + "icon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "onClick": [Function], + "tooltip": "Delete Policy", + }, + ] + } + columns={ + Array [ + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "field": "name", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Policy Name", + }, + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "field": "version", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Policy Version", + }, + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "field": "type", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Policy Type", + }, + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "field": "type_version", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Policy Type Version", + }, + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "field": "supportedPdpGroupsString", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Deployable in PDP Group", + }, + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "field": "pdpGroupInfoString", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Deployed in PDP Group", + }, + ] + } + data={Array []} + detailPanel={ + Array [ + Object { + "icon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "render": [Function], + "tooltip": "Show Configuration", + }, + Object { + "icon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "openIcon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "render": [Function], + "tooltip": "Show Raw Data", + }, + Object { + "icon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "openIcon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "render": [Function], + "tooltip": "PDP Group Deployment", + }, + ] + } + icons={ + Object { + "Add": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Check": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Clear": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Delete": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "DetailPanel": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Edit": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Export": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Filter": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "FirstPage": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "LastPage": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "NextPage": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "PreviousPage": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "ResetSearch": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Search": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "SortArrow": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "ThirdStateCheck": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "ViewColumn": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + } + } + onRowClick={[Function]} + options={ + Object { + "actionsColumnIndex": -1, + "exportButton": true, + "grouping": true, + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "1px solid black", + "fontSize": "15pt", + "text": "bold", + }, + } + } + title="Policies" + /> + </styled.div> + </div> + </ModalBody> + </Tab> + <Tab + eventKey="tosca models" + title="Tosca Models in Policy Framework" + > + <ModalBody> + <div> + <styled.div> + <PoliciesTreeViewer + policiesData={Array []} + policiesFilterFunction={[Function]} + valueForTreeCreation="policyModelType" + /> + </styled.div> + <styled.div> + <WithStyles(Component) + actions={ + Array [ + Object { + "icon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "isFreeAction": true, + "onClick": [Function], + "tooltip": "Add New Tosca Model", + }, + ] + } + columns={ + Array [ + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "field": "policyModelType", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Policy Model Type", + }, + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "field": "policyAcronym", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Policy Acronym", + }, + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "field": "version", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Version", + }, + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "field": "updatedBy", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Uploaded By", + }, + Object { + "cellStyle": Object { + "backgroundColor": "#039be5", + "border": "1px solid black", + "color": "#FFF", + }, + "editable": "never", + "field": "updatedDate", + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "2px solid black", + }, + "title": "Uploaded Date", + }, + ] + } + data={Array []} + detailPanel={ + Array [ + Object { + "icon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "render": [Function], + "tooltip": "Show Tosca", + }, + Object { + "icon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "openIcon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "render": [Function], + "tooltip": "Show Raw Data", + }, + Object { + "icon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "openIcon": Object { + "$$typeof": Symbol(react.memo), + "compare": null, + "type": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + }, + "render": [Function], + "tooltip": "Create a policy from this model", + }, + ] + } + icons={ + Object { + "Add": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Check": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Clear": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Delete": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "DetailPanel": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Edit": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Export": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Filter": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "FirstPage": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "LastPage": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "NextPage": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "PreviousPage": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "ResetSearch": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "Search": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "SortArrow": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "ThirdStateCheck": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + "ViewColumn": Object { + "$$typeof": Symbol(react.forward_ref), + "render": [Function], + }, + } + } + onRowClick={[Function]} + options={ + Object { + "actionsColumnIndex": -1, + "exportButton": true, + "grouping": true, + "headerStyle": Object { + "backgroundColor": "#ddd", + "border": "1px solid black", + "fontSize": "15pt", + "text": "bold", + }, + } + } + title="Tosca Models" + /> + </styled.div> + </div> + </ModalBody> + </Tab> + </Tabs> + <Alert + closeLabel="Close alert" + dismissible={true} + onClose={[Function]} + show={false} + transition={ + Object { + "$$typeof": Symbol(react.forward_ref), + "defaultProps": Object { + "appear": false, + "in": false, + "mountOnEnter": false, + "timeout": 300, + "unmountOnExit": false, + }, + "render": [Function], + } + } + variant="success" + > + <styled.div /> + </Alert> + <Alert + closeLabel="Close alert" + dismissible={true} + onClose={[Function]} + show={false} + transition={ + Object { + "$$typeof": Symbol(react.forward_ref), + "defaultProps": Object { + "appear": false, + "in": false, + "mountOnEnter": false, + "timeout": 300, + "unmountOnExit": false, + }, + "render": [Function], + } + } + variant="danger" + > + <styled.div /> + </Alert> + <ModalFooter> + <Button + active={false} + disabled={false} + onClick={[Function]} + variant="secondary" + > + Close + </Button> + </ModalFooter> + </Styled(Modal)> + <PolicyToscaFileSelector + disableFunction={[Function]} + show={false} + toscaTableUpdateFunction={[Function]} + /> +</Fragment> +`; |