Skip to content

Commit

Permalink
[PipelineViewer] Test PipelineViewer sub-components (#20329)
Browse files Browse the repository at this point in the history
* Rename config view to PipelineViewer.

* Decouple CollapsibleStatement from if/else using props.children.

* Add tests for PipelineViewer component.

* Test Metric component.

* Test CollapsibleStatement component.

* Test PluginStatement component.

* Test Queue component.

* Test StatementListHeading component.

* Test StatementSection component. Move StatementList component to dedicated file.

* Test StatementList component.

* Test Statement component.

* Run prettier on edited files.
  • Loading branch information
justinkambic committed Jul 9, 2018
1 parent 3b3dc0b commit da2448f
Show file tree
Hide file tree
Showing 26 changed files with 1,680 additions and 273 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CollapsibleStatement component renders child components 1`] = `
<EuiFlexGroup
alignItems="center"
className="pipelineViewer__statement"
component="div"
direction="row"
gutterSize="none"
justifyContent="flexStart"
responsive={false}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
key="statementId"
>
<EuiButtonIcon
aria-label={true}
color="text"
iconType="arrowDown"
onClick={[Function]}
size="s"
type="button"
/>
</EuiFlexItem>
<div>
child element
</div>
</EuiFlexGroup>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Metric component does not render warning badge when no warning present 1`] = `
<EuiFlexItem
className="pipelineViewer__metricFlexItem"
component="div"
grow={false}
>
<EuiText
className="pipelineViewer__metric metricClass"
color="subdued"
grow={true}
size="s"
>
<span>
220
</span>
</EuiText>
</EuiFlexItem>
`;

exports[`Metric component renders warning badge 1`] = `
<EuiFlexItem
className="pipelineViewer__metricFlexItem"
component="div"
grow={false}
>
<EuiBadge
className="metricClass"
color="warning"
iconSide="left"
>
220
</EuiBadge>
</EuiFlexItem>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PipelineViewer component passes expected props 1`] = `
<EuiPage
restrictWidth={false}
>
<EuiPageContent
className="pipelineViewer"
horizontalPosition="center"
panelPaddingSize="l"
verticalPosition="center"
>
<StatementSection
detailVertex={null}
elements={
Array [
Object {
"depth": 0,
"id": "standardInput",
"parentId": null,
},
]
}
headingText="Inputs"
iconType="logstashInput"
onShowVertexDetails={[Function]}
/>
<EuiSpacer
size="l"
/>
<Queue
queue={
Object {
"hasExplicitId": false,
"id": "__QUEUE__",
"meta": null,
"stats": Array [],
}
}
/>
<EuiSpacer
size="l"
/>
<StatementSection
detailVertex={null}
elements={
Array [
Object {
"depth": 0,
"id": "mutate",
"parentId": null,
},
]
}
headingText="Filters"
iconType="logstashFilter"
onShowVertexDetails={[Function]}
/>
<EuiSpacer
size="l"
/>
<StatementSection
detailVertex={null}
elements={
Array [
Object {
"depth": 0,
"id": "elasticsearch",
"parentId": null,
},
]
}
headingText="Outputs"
iconType="logstashOutput"
onShowVertexDetails={[Function]}
/>
</EuiPageContent>
</EuiPage>
`;

exports[`PipelineViewer component renders DetailDrawer when selected vertex is not null 1`] = `
<EuiPage
restrictWidth={false}
>
<EuiPageContent
className="pipelineViewer"
horizontalPosition="center"
panelPaddingSize="l"
verticalPosition="center"
>
<StatementSection
detailVertex={
Object {
"id": "stdin",
}
}
elements={
Array [
Object {
"depth": 0,
"id": "standardInput",
"parentId": null,
},
]
}
headingText="Inputs"
iconType="logstashInput"
onShowVertexDetails={[Function]}
/>
<EuiSpacer
size="l"
/>
<Queue
queue={
Object {
"hasExplicitId": false,
"id": "__QUEUE__",
"meta": null,
"stats": Array [],
}
}
/>
<EuiSpacer
size="l"
/>
<StatementSection
detailVertex={
Object {
"id": "stdin",
}
}
elements={
Array [
Object {
"depth": 0,
"id": "mutate",
"parentId": null,
},
]
}
headingText="Filters"
iconType="logstashFilter"
onShowVertexDetails={[Function]}
/>
<EuiSpacer
size="l"
/>
<StatementSection
detailVertex={
Object {
"id": "stdin",
}
}
elements={
Array [
Object {
"depth": 0,
"id": "elasticsearch",
"parentId": null,
},
]
}
headingText="Outputs"
iconType="logstashOutput"
onShowVertexDetails={[Function]}
/>
<DetailDrawer
onHide={[Function]}
vertex={
Object {
"id": "stdin",
}
}
/>
</EuiPageContent>
</EuiPage>
`;
Loading

0 comments on commit da2448f

Please sign in to comment.