mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 02:41:39 +00:00
tests
This commit is contained in:
@@ -27,6 +27,6 @@ export function getWorkloadType(): WorkloadType {
|
|||||||
return workloadType;
|
return workloadType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isMaterializedViewsEnabled() {
|
export function isMaterializedViewsEnabled(): boolean {
|
||||||
return userContext.apiType === "SQL" && userContext.databaseAccount?.properties?.enableMaterializedViews;
|
return userContext.apiType === "SQL" && userContext.databaseAccount?.properties?.enableMaterializedViews;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { shallow } from "enzyme";
|
import { shallow } from "enzyme";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import { AddCollectionPanel } from "./AddCollectionPanel";
|
import { AddCollectionPanel } from "./AddCollectionPanel";
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
|
|||||||
@@ -1,22 +1,20 @@
|
|||||||
import { shallow } from "enzyme";
|
import { shallow, ShallowWrapper } from "enzyme";
|
||||||
import Explorer from "Explorer/Explorer";
|
import Explorer from "Explorer/Explorer";
|
||||||
import { AddMaterializedViewPanel, AddMaterializedViewPanelProps } from "Explorer/Panes/AddMaterializedViewPanel/AddMaterializedViewPanel";
|
import { AddMaterializedViewPanel, AddMaterializedViewPanelProps } from "Explorer/Panes/AddMaterializedViewPanel/AddMaterializedViewPanel";
|
||||||
import React from "react";
|
import React, { Component } from "react";
|
||||||
|
|
||||||
const props: AddMaterializedViewPanelProps = {
|
const props: AddMaterializedViewPanelProps = {
|
||||||
explorer: new Explorer(),
|
explorer: new Explorer()
|
||||||
sourceContainer: new Collection()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
describe("AddMaterializedViewPanel", () => {
|
describe("AddMaterializedViewPanel", () => {
|
||||||
const wrapper = shallow(<AddMaterializedViewPanel {...props} />);
|
it("render default panel", () => {
|
||||||
|
const wrapper: ShallowWrapper<AddMaterializedViewPanelProps, {}, Component> = shallow(<AddMaterializedViewPanel {...props} />);
|
||||||
it("Render default properly", () => {
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should render form", () => {
|
it("should render form", () => {
|
||||||
|
const wrapper: ShallowWrapper<AddMaterializedViewPanelProps, {}, Component> = shallow(<AddMaterializedViewPanel {...props} />);
|
||||||
const form = wrapper.find("form").first();
|
const form = wrapper.find("form").first();
|
||||||
expect(form).toBeDefined();
|
expect(form).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,195 +1,6 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`AddMaterializedViewPanel Render default properly 1`] = `
|
exports[`AddMaterializedViewPanel render default panel 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
|
<form
|
||||||
className="panelFormWrapper"
|
className="panelFormWrapper"
|
||||||
id="panelMaterializedView"
|
id="panelMaterializedView"
|
||||||
|
|||||||
Reference in New Issue
Block a user