mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-20 16:48:55 +01:00
add tests
This commit is contained in:
parent
69cf523274
commit
6b811b5e76
@ -0,0 +1,23 @@
|
|||||||
|
import { shallow } from "enzyme";
|
||||||
|
import Explorer from "Explorer/Explorer";
|
||||||
|
import { AddMaterializedViewPanel, AddMaterializedViewPanelProps } from "Explorer/Panes/AddMaterializedViewPanel/AddMaterializedViewPanel";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const props: AddMaterializedViewPanelProps = {
|
||||||
|
explorer: new Explorer(),
|
||||||
|
sourceContainer: new Collection()
|
||||||
|
};
|
||||||
|
|
||||||
|
describe("AddMaterializedViewPanel", () => {
|
||||||
|
const wrapper = shallow(<AddMaterializedViewPanel {...props} />);
|
||||||
|
|
||||||
|
it("Render default properly", () => {
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should render form", () => {
|
||||||
|
|
||||||
|
const form = wrapper.find("form").first();
|
||||||
|
expect(form).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,379 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`AddMaterializedViewPanel Render default properly 1`] = `
|
||||||
|
<form
|
||||||
|
className="panelFormWrapper"
|
||||||
|
id="panelMaterializedView"
|
||||||
|
onSubmit={[Function]}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="panelMainContent"
|
||||||
|
>
|
||||||
|
<Stack>
|
||||||
|
<Stack
|
||||||
|
horizontal={true}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="mandatoryStar"
|
||||||
|
>
|
||||||
|
*
|
||||||
|
</span>
|
||||||
|
<Text
|
||||||
|
className="panelTextBold"
|
||||||
|
variant="small"
|
||||||
|
>
|
||||||
|
Source container id
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
<Dropdown
|
||||||
|
onChange={[Function]}
|
||||||
|
placeholder="Choose source container"
|
||||||
|
style={
|
||||||
|
{
|
||||||
|
"fontSize": 12,
|
||||||
|
"width": 300,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
styles={
|
||||||
|
{
|
||||||
|
"dropdownItem": {
|
||||||
|
"fontSize": 12,
|
||||||
|
},
|
||||||
|
"dropdownItemDisabled": {
|
||||||
|
"fontSize": 12,
|
||||||
|
},
|
||||||
|
"dropdownItemSelected": {
|
||||||
|
"fontSize": 12,
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"height": 27,
|
||||||
|
"lineHeight": 27,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Separator
|
||||||
|
className="panelSeparator"
|
||||||
|
/>
|
||||||
|
<Stack
|
||||||
|
horizontal={true}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="mandatoryStar"
|
||||||
|
>
|
||||||
|
*
|
||||||
|
</span>
|
||||||
|
<Text
|
||||||
|
className="panelTextBold"
|
||||||
|
variant="small"
|
||||||
|
>
|
||||||
|
View container id
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
<input
|
||||||
|
aria-required={true}
|
||||||
|
autoComplete="off"
|
||||||
|
className="panelTextField"
|
||||||
|
id="materializedViewId"
|
||||||
|
onChange={[Function]}
|
||||||
|
pattern="[^/?#\\\\]*[^/?# \\\\]"
|
||||||
|
placeholder="e.g., viewByEmailId"
|
||||||
|
required={true}
|
||||||
|
size={40}
|
||||||
|
title="May not end with space nor contain characters '\\' '/' '#' '?'"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<Stack
|
||||||
|
horizontal={true}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="mandatoryStar"
|
||||||
|
>
|
||||||
|
*
|
||||||
|
</span>
|
||||||
|
<Text
|
||||||
|
className="panelTextBold"
|
||||||
|
variant="small"
|
||||||
|
>
|
||||||
|
Materialized View Definition
|
||||||
|
</Text>
|
||||||
|
<StyledTooltipHostBase
|
||||||
|
content={
|
||||||
|
<StyledLinkBase
|
||||||
|
href="https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/materialized-views#defining-materialized-views"
|
||||||
|
target="blank"
|
||||||
|
>
|
||||||
|
Learn more about defining materialized views.
|
||||||
|
</StyledLinkBase>
|
||||||
|
}
|
||||||
|
directionalHint={4}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
className="panelInfoIcon"
|
||||||
|
iconName="Info"
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
/>
|
||||||
|
</StyledTooltipHostBase>
|
||||||
|
</Stack>
|
||||||
|
<input
|
||||||
|
aria-required={true}
|
||||||
|
autoComplete="off"
|
||||||
|
className="panelTextField"
|
||||||
|
id="materializedViewDefinition"
|
||||||
|
onChange={[Function]}
|
||||||
|
placeholder="SELECT c.email, c.accountId FROM c"
|
||||||
|
required={true}
|
||||||
|
size={40}
|
||||||
|
type="text"
|
||||||
|
value=""
|
||||||
|
/>
|
||||||
|
<AddMVPartitionKeyComponent
|
||||||
|
partitionKey=""
|
||||||
|
setPartitionKey={[Function]}
|
||||||
|
setSubPartitionKeys={[Function]}
|
||||||
|
subPartitionKeys={[]}
|
||||||
|
/>
|
||||||
|
<AddMVThroughputComponent
|
||||||
|
isCostAknowledgedOnChange={[Function]}
|
||||||
|
isMaterializedViewAutoscaleOnChange={[Function]}
|
||||||
|
isSelectedSourceContainerSharedThroughput={[Function]}
|
||||||
|
materializedViewThroughputOnChange={[Function]}
|
||||||
|
setEnabledDedicatedThroughput={[Function]}
|
||||||
|
setIsThroughputCapExceeded={[Function]}
|
||||||
|
showCollectionThroughputInput={[Function]}
|
||||||
|
/>
|
||||||
|
<AddMVUniqueKeysComponent
|
||||||
|
setUniqueKeys={[Function]}
|
||||||
|
uniqueKeys={[]}
|
||||||
|
/>
|
||||||
|
<AddMVAnalyticalStoreComponent
|
||||||
|
explorer={
|
||||||
|
Explorer {
|
||||||
|
"_isInitializingNotebooks": false,
|
||||||
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
|
"isTabsContentExpanded": [Function],
|
||||||
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
|
"onRefreshResourcesClick": [Function],
|
||||||
|
"phoenixClient": PhoenixClient {
|
||||||
|
"armResourceId": undefined,
|
||||||
|
"retryOptions": {
|
||||||
|
"maxTimeout": 5000,
|
||||||
|
"minTimeout": 5000,
|
||||||
|
"retries": 3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"provideFeedbackEmail": [Function],
|
||||||
|
"queriesClient": QueriesClient {
|
||||||
|
"container": [Circular],
|
||||||
|
},
|
||||||
|
"refreshNotebookList": [Function],
|
||||||
|
"resourceTree": ResourceTreeAdapter {
|
||||||
|
"container": [Circular],
|
||||||
|
"copyNotebook": [Function],
|
||||||
|
"parameters": [Function],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setEnableAnalyticalStore={[Function]}
|
||||||
|
/>
|
||||||
|
<AddMVAdvancedComponent
|
||||||
|
setSubPartitionKeys={[Function]}
|
||||||
|
setUseHashV1={[Function]}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</div>
|
||||||
|
<PanelFooterComponent
|
||||||
|
buttonLabel="OK"
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`AddMaterializedViewpanel should render Default properly 1`] = `
|
||||||
|
<form
|
||||||
|
className="panelFormWrapper"
|
||||||
|
id="panelMaterializedView"
|
||||||
|
onSubmit={[Function]}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="panelMainContent"
|
||||||
|
>
|
||||||
|
<Stack>
|
||||||
|
<Stack
|
||||||
|
horizontal={true}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="mandatoryStar"
|
||||||
|
>
|
||||||
|
*
|
||||||
|
</span>
|
||||||
|
<Text
|
||||||
|
className="panelTextBold"
|
||||||
|
variant="small"
|
||||||
|
>
|
||||||
|
Source container id
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
<Dropdown
|
||||||
|
onChange={[Function]}
|
||||||
|
placeholder="Choose source container"
|
||||||
|
style={
|
||||||
|
{
|
||||||
|
"fontSize": 12,
|
||||||
|
"width": 300,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
styles={
|
||||||
|
{
|
||||||
|
"dropdownItem": {
|
||||||
|
"fontSize": 12,
|
||||||
|
},
|
||||||
|
"dropdownItemDisabled": {
|
||||||
|
"fontSize": 12,
|
||||||
|
},
|
||||||
|
"dropdownItemSelected": {
|
||||||
|
"fontSize": 12,
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"height": 27,
|
||||||
|
"lineHeight": 27,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Separator
|
||||||
|
className="panelSeparator"
|
||||||
|
/>
|
||||||
|
<Stack
|
||||||
|
horizontal={true}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="mandatoryStar"
|
||||||
|
>
|
||||||
|
*
|
||||||
|
</span>
|
||||||
|
<Text
|
||||||
|
className="panelTextBold"
|
||||||
|
variant="small"
|
||||||
|
>
|
||||||
|
View container id
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
<input
|
||||||
|
aria-required={true}
|
||||||
|
autoComplete="off"
|
||||||
|
className="panelTextField"
|
||||||
|
id="materializedViewId"
|
||||||
|
onChange={[Function]}
|
||||||
|
pattern="[^/?#\\\\]*[^/?# \\\\]"
|
||||||
|
placeholder="e.g., viewByEmailId"
|
||||||
|
required={true}
|
||||||
|
size={40}
|
||||||
|
title="May not end with space nor contain characters '\\' '/' '#' '?'"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<Stack
|
||||||
|
horizontal={true}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="mandatoryStar"
|
||||||
|
>
|
||||||
|
*
|
||||||
|
</span>
|
||||||
|
<Text
|
||||||
|
className="panelTextBold"
|
||||||
|
variant="small"
|
||||||
|
>
|
||||||
|
Materialized View Definition
|
||||||
|
</Text>
|
||||||
|
<StyledTooltipHostBase
|
||||||
|
content={
|
||||||
|
<StyledLinkBase
|
||||||
|
href="https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/materialized-views#defining-materialized-views"
|
||||||
|
target="blank"
|
||||||
|
>
|
||||||
|
Learn more about defining materialized views.
|
||||||
|
</StyledLinkBase>
|
||||||
|
}
|
||||||
|
directionalHint={4}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
className="panelInfoIcon"
|
||||||
|
iconName="Info"
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
/>
|
||||||
|
</StyledTooltipHostBase>
|
||||||
|
</Stack>
|
||||||
|
<input
|
||||||
|
aria-required={true}
|
||||||
|
autoComplete="off"
|
||||||
|
className="panelTextField"
|
||||||
|
id="materializedViewDefinition"
|
||||||
|
onChange={[Function]}
|
||||||
|
placeholder="SELECT c.email, c.accountId FROM c"
|
||||||
|
required={true}
|
||||||
|
size={40}
|
||||||
|
type="text"
|
||||||
|
value=""
|
||||||
|
/>
|
||||||
|
<AddMVPartitionKeyComponent
|
||||||
|
partitionKey=""
|
||||||
|
setPartitionKey={[Function]}
|
||||||
|
setSubPartitionKeys={[Function]}
|
||||||
|
subPartitionKeys={[]}
|
||||||
|
/>
|
||||||
|
<AddMVThroughputComponent
|
||||||
|
isCostAknowledgedOnChange={[Function]}
|
||||||
|
isMaterializedViewAutoscaleOnChange={[Function]}
|
||||||
|
isSelectedSourceContainerSharedThroughput={[Function]}
|
||||||
|
materializedViewThroughputOnChange={[Function]}
|
||||||
|
setEnabledDedicatedThroughput={[Function]}
|
||||||
|
setIsThroughputCapExceeded={[Function]}
|
||||||
|
showCollectionThroughputInput={[Function]}
|
||||||
|
/>
|
||||||
|
<AddMVUniqueKeysComponent
|
||||||
|
setUniqueKeys={[Function]}
|
||||||
|
uniqueKeys={[]}
|
||||||
|
/>
|
||||||
|
<AddMVAnalyticalStoreComponent
|
||||||
|
explorer={
|
||||||
|
Explorer {
|
||||||
|
"_isInitializingNotebooks": false,
|
||||||
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
|
"isTabsContentExpanded": [Function],
|
||||||
|
"onRefreshDatabasesKeyPress": [Function],
|
||||||
|
"onRefreshResourcesClick": [Function],
|
||||||
|
"phoenixClient": PhoenixClient {
|
||||||
|
"armResourceId": undefined,
|
||||||
|
"retryOptions": {
|
||||||
|
"maxTimeout": 5000,
|
||||||
|
"minTimeout": 5000,
|
||||||
|
"retries": 3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"provideFeedbackEmail": [Function],
|
||||||
|
"queriesClient": QueriesClient {
|
||||||
|
"container": [Circular],
|
||||||
|
},
|
||||||
|
"refreshNotebookList": [Function],
|
||||||
|
"resourceTree": ResourceTreeAdapter {
|
||||||
|
"container": [Circular],
|
||||||
|
"copyNotebook": [Function],
|
||||||
|
"parameters": [Function],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setEnableAnalyticalStore={[Function]}
|
||||||
|
/>
|
||||||
|
<AddMVAdvancedComponent
|
||||||
|
setSubPartitionKeys={[Function]}
|
||||||
|
setUseHashV1={[Function]}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</div>
|
||||||
|
<PanelFooterComponent
|
||||||
|
buttonLabel="OK"
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
`;
|
Loading…
x
Reference in New Issue
Block a user