diff --git a/src/Explorer/Panes/AddMaterializedViewPanel/AddMaterializedViewPanel.test.tsx b/src/Explorer/Panes/AddMaterializedViewPanel/AddMaterializedViewPanel.test.tsx new file mode 100644 index 000000000..539e750aa --- /dev/null +++ b/src/Explorer/Panes/AddMaterializedViewPanel/AddMaterializedViewPanel.test.tsx @@ -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(); + }); +}); \ No newline at end of file diff --git a/src/Explorer/Panes/AddMaterializedViewPanel/__snapshots__/AddMaterializedViewPanel.test.tsx.snap b/src/Explorer/Panes/AddMaterializedViewPanel/__snapshots__/AddMaterializedViewPanel.test.tsx.snap new file mode 100644 index 000000000..cf095f354 --- /dev/null +++ b/src/Explorer/Panes/AddMaterializedViewPanel/__snapshots__/AddMaterializedViewPanel.test.tsx.snap @@ -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> +`;