mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-13 07:57:26 +01:00
fixed failed test case
This commit is contained in:
@@ -15,11 +15,14 @@ describe("Excute Edit Table Entity Pane", () => {
|
|||||||
fakeTableEntityListViewModel.headers = [];
|
fakeTableEntityListViewModel.headers = [];
|
||||||
fakeTableEntityListViewModel.selected = ko.observableArray<Entities.ITableEntity>([{}]);
|
fakeTableEntityListViewModel.selected = ko.observableArray<Entities.ITableEntity>([{}]);
|
||||||
|
|
||||||
|
const fakeSelectedItem = [{ PartitionKey: { _: "test", $: "String" } }];
|
||||||
const props = {
|
const props = {
|
||||||
tableDataClient: new TablesAPIDataClient(),
|
tableDataClient: new TablesAPIDataClient(),
|
||||||
queryTablesTab: fakeQueryTablesTab,
|
queryTablesTab: fakeQueryTablesTab,
|
||||||
tableEntityListViewModel: fakeTableEntityListViewModel,
|
tableEntityListViewModel: fakeTableEntityListViewModel,
|
||||||
cassandraApiClient: fakeCassandraApiClient,
|
cassandraApiClient: fakeCassandraApiClient,
|
||||||
|
selectedEntity: fakeSelectedItem,
|
||||||
|
reloadEntities: () => "{}",
|
||||||
};
|
};
|
||||||
|
|
||||||
it("should render Default properly", () => {
|
it("should render Default properly", () => {
|
||||||
@@ -29,13 +32,13 @@ describe("Excute Edit Table Entity Pane", () => {
|
|||||||
|
|
||||||
it("initially display 4 input field, 2 properties and 1 entity values", () => {
|
it("initially display 4 input field, 2 properties and 1 entity values", () => {
|
||||||
const wrapper = mount(<EditTableEntityPanel {...props} />);
|
const wrapper = mount(<EditTableEntityPanel {...props} />);
|
||||||
expect(wrapper.find("input[type='text']")).toHaveLength(0);
|
expect(wrapper.find("input[type='text']")).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("add a new entity row", () => {
|
it("add a new entity row", () => {
|
||||||
const wrapper = mount(<EditTableEntityPanel {...props} />);
|
const wrapper = mount(<EditTableEntityPanel {...props} />);
|
||||||
wrapper.find(".addButtonEntiy").last().simulate("click");
|
wrapper.find(".addButtonEntiy").last().simulate("click");
|
||||||
expect(wrapper.find("input[type='text']")).toHaveLength(1);
|
expect(wrapper.find("input[type='text']")).toHaveLength(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("remove a entity field", () => {
|
it("remove a entity field", () => {
|
||||||
@@ -43,6 +46,6 @@ describe("Excute Edit Table Entity Pane", () => {
|
|||||||
// Since default entity row doesn't have delete option, so added row then delete for test cases.
|
// Since default entity row doesn't have delete option, so added row then delete for test cases.
|
||||||
wrapper.find(".addButtonEntiy").last().simulate("click");
|
wrapper.find(".addButtonEntiy").last().simulate("click");
|
||||||
wrapper.find("#deleteEntity").last().simulate("click");
|
wrapper.find("#deleteEntity").last().simulate("click");
|
||||||
expect(wrapper.find("input[type='text']")).toHaveLength(0);
|
expect(wrapper.find("input[type='text']")).toHaveLength(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -81,15 +81,8 @@ export const EditTableEntityPanel: FunctionComponent<EditTableEntityPanelProps>
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
let originalDocument: { [key: string]: any } = {};
|
let originalDocument: { [key: string]: any } = {};
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
// const entityAttribute: any = tableEntityListViewModel.selected();
|
|
||||||
// const entityFormattedAttribute = constructDisplayedAttributes(entityAttribute[0]);
|
|
||||||
const entityAttribute: any = selectedEntity;
|
const entityAttribute: any = selectedEntity;
|
||||||
console.log("🚀 ~ file: EditTableEntityPanel.tsx ~ line 86 ~ useEffect ~ entityAttribute", entityAttribute);
|
const entityFormattedAttribute = constructDisplayedAttributes(entityAttribute && entityAttribute[0]);
|
||||||
const entityFormattedAttribute = constructDisplayedAttributes(entityAttribute[0]);
|
|
||||||
console.log(
|
|
||||||
"🚀 ~ file: EditTableEntityPanel.tsx ~ line 88 ~ useEffect ~ entityFormattedAttribute",
|
|
||||||
entityFormattedAttribute
|
|
||||||
);
|
|
||||||
setEntities(entityFormattedAttribute);
|
setEntities(entityFormattedAttribute);
|
||||||
|
|
||||||
if (userContext.apiType === "Tables") {
|
if (userContext.apiType === "Tables") {
|
||||||
|
|||||||
+10
-10
@@ -647,14 +647,14 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
</StyledCheckboxBase>
|
</StyledCheckboxBase>
|
||||||
<StyledCheckboxBase
|
<StyledCheckboxBase
|
||||||
checked={true}
|
checked={true}
|
||||||
disabled={false}
|
disabled={true}
|
||||||
key=""
|
key=""
|
||||||
label=""
|
label=""
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
>
|
>
|
||||||
<CheckboxBase
|
<CheckboxBase
|
||||||
checked={true}
|
checked={true}
|
||||||
disabled={false}
|
disabled={true}
|
||||||
label=""
|
label=""
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
styles={[Function]}
|
styles={[Function]}
|
||||||
@@ -933,34 +933,34 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="ms-Checkbox is-checked is-enabled root-54"
|
className="ms-Checkbox is-checked is-disabled root-62"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-checked="true"
|
aria-checked="true"
|
||||||
aria-disabled={false}
|
aria-disabled={true}
|
||||||
aria-label=""
|
aria-label=""
|
||||||
checked={true}
|
checked={true}
|
||||||
className="input-55"
|
className="input-55"
|
||||||
data-ktp-execute-target={true}
|
data-ktp-execute-target={true}
|
||||||
disabled={false}
|
disabled={true}
|
||||||
id="checkbox-0"
|
id="checkbox-0"
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
/>
|
/>
|
||||||
<label
|
<label
|
||||||
className="ms-Checkbox-label label-56"
|
className="ms-Checkbox-label label-63"
|
||||||
htmlFor="checkbox-0"
|
htmlFor="checkbox-0"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="ms-Checkbox-checkbox checkbox-57"
|
className="ms-Checkbox-checkbox checkbox-64"
|
||||||
data-ktp-target={true}
|
data-ktp-target={true}
|
||||||
>
|
>
|
||||||
<StyledIconBase
|
<StyledIconBase
|
||||||
className="ms-Checkbox-checkmark checkmark-58"
|
className="ms-Checkbox-checkmark checkmark-65"
|
||||||
iconName="CheckMark"
|
iconName="CheckMark"
|
||||||
>
|
>
|
||||||
<IconBase
|
<IconBase
|
||||||
className="ms-Checkbox-checkmark checkmark-58"
|
className="ms-Checkbox-checkmark checkmark-65"
|
||||||
iconName="CheckMark"
|
iconName="CheckMark"
|
||||||
styles={[Function]}
|
styles={[Function]}
|
||||||
theme={
|
theme={
|
||||||
@@ -1239,7 +1239,7 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
|||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
aria-hidden={true}
|
aria-hidden={true}
|
||||||
className="ms-Checkbox-checkmark checkmark-61"
|
className="ms-Checkbox-checkmark checkmark-67"
|
||||||
data-icon-name="CheckMark"
|
data-icon-name="CheckMark"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user