mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 02:41:39 +00:00
fixed failed test case
This commit is contained in:
@@ -15,11 +15,14 @@ describe("Excute Edit Table Entity Pane", () => {
|
||||
fakeTableEntityListViewModel.headers = [];
|
||||
fakeTableEntityListViewModel.selected = ko.observableArray<Entities.ITableEntity>([{}]);
|
||||
|
||||
const fakeSelectedItem = [{ PartitionKey: { _: "test", $: "String" } }];
|
||||
const props = {
|
||||
tableDataClient: new TablesAPIDataClient(),
|
||||
queryTablesTab: fakeQueryTablesTab,
|
||||
tableEntityListViewModel: fakeTableEntityListViewModel,
|
||||
cassandraApiClient: fakeCassandraApiClient,
|
||||
selectedEntity: fakeSelectedItem,
|
||||
reloadEntities: () => "{}",
|
||||
};
|
||||
|
||||
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", () => {
|
||||
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", () => {
|
||||
const wrapper = mount(<EditTableEntityPanel {...props} />);
|
||||
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", () => {
|
||||
@@ -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.
|
||||
wrapper.find(".addButtonEntiy").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
|
||||
let originalDocument: { [key: string]: any } = {};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// const entityAttribute: any = tableEntityListViewModel.selected();
|
||||
// const entityFormattedAttribute = constructDisplayedAttributes(entityAttribute[0]);
|
||||
const entityAttribute: any = selectedEntity;
|
||||
console.log("🚀 ~ file: EditTableEntityPanel.tsx ~ line 86 ~ useEffect ~ entityAttribute", entityAttribute);
|
||||
const entityFormattedAttribute = constructDisplayedAttributes(entityAttribute[0]);
|
||||
console.log(
|
||||
"🚀 ~ file: EditTableEntityPanel.tsx ~ line 88 ~ useEffect ~ entityFormattedAttribute",
|
||||
entityFormattedAttribute
|
||||
);
|
||||
const entityFormattedAttribute = constructDisplayedAttributes(entityAttribute && entityAttribute[0]);
|
||||
setEntities(entityFormattedAttribute);
|
||||
|
||||
if (userContext.apiType === "Tables") {
|
||||
|
||||
@@ -647,14 +647,14 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
||||
</StyledCheckboxBase>
|
||||
<StyledCheckboxBase
|
||||
checked={true}
|
||||
disabled={false}
|
||||
disabled={true}
|
||||
key=""
|
||||
label=""
|
||||
onChange={[Function]}
|
||||
>
|
||||
<CheckboxBase
|
||||
checked={true}
|
||||
disabled={false}
|
||||
disabled={true}
|
||||
label=""
|
||||
onChange={[Function]}
|
||||
styles={[Function]}
|
||||
@@ -933,34 +933,34 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
||||
}
|
||||
>
|
||||
<div
|
||||
className="ms-Checkbox is-checked is-enabled root-54"
|
||||
className="ms-Checkbox is-checked is-disabled root-62"
|
||||
>
|
||||
<input
|
||||
aria-checked="true"
|
||||
aria-disabled={false}
|
||||
aria-disabled={true}
|
||||
aria-label=""
|
||||
checked={true}
|
||||
className="input-55"
|
||||
data-ktp-execute-target={true}
|
||||
disabled={false}
|
||||
disabled={true}
|
||||
id="checkbox-0"
|
||||
onChange={[Function]}
|
||||
type="checkbox"
|
||||
/>
|
||||
<label
|
||||
className="ms-Checkbox-label label-56"
|
||||
className="ms-Checkbox-label label-63"
|
||||
htmlFor="checkbox-0"
|
||||
>
|
||||
<div
|
||||
className="ms-Checkbox-checkbox checkbox-57"
|
||||
className="ms-Checkbox-checkbox checkbox-64"
|
||||
data-ktp-target={true}
|
||||
>
|
||||
<StyledIconBase
|
||||
className="ms-Checkbox-checkmark checkmark-58"
|
||||
className="ms-Checkbox-checkmark checkmark-65"
|
||||
iconName="CheckMark"
|
||||
>
|
||||
<IconBase
|
||||
className="ms-Checkbox-checkmark checkmark-58"
|
||||
className="ms-Checkbox-checkmark checkmark-65"
|
||||
iconName="CheckMark"
|
||||
styles={[Function]}
|
||||
theme={
|
||||
@@ -1239,7 +1239,7 @@ exports[`Table query select Panel should render Default properly 1`] = `
|
||||
>
|
||||
<i
|
||||
aria-hidden={true}
|
||||
className="ms-Checkbox-checkmark checkmark-61"
|
||||
className="ms-Checkbox-checkmark checkmark-67"
|
||||
data-icon-name="CheckMark"
|
||||
>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user