Implement bulk delete documents for Mongo (#1859)

* Implement bulk delete documents for Mongo

* Fix unit test

* Adding bulkdelete to new mongo apis

* Fix error message

* Fix typo

* Improve error message wording

* Fix format

* Fix format

* Put back old delete for older container with system partition key
This commit is contained in:
Laurent Nguyen
2024-08-21 16:59:52 +02:00
committed by GitHub
parent 2226169a71
commit 5a5e155205
4 changed files with 76 additions and 69 deletions

View File

@@ -1,4 +1,4 @@
import { deleteDocument } from "Common/MongoProxyClient";
import { deleteDocuments } from "Common/MongoProxyClient";
import { Platform, updateConfigContext } from "ConfigContext";
import { EditorReactProps } from "Explorer/Controls/Editor/EditorReact";
import { useCommandBar } from "Explorer/Menus/CommandBar/CommandBarComponentAdapter";
@@ -49,7 +49,7 @@ jest.mock("Common/MongoProxyClient", () => ({
id: "id1",
}),
),
deleteDocument: jest.fn(() => Promise.resolve()),
deleteDocuments: jest.fn(() => Promise.resolve()),
}));
jest.mock("Explorer/Controls/Editor/EditorReact", () => ({
@@ -179,8 +179,8 @@ describe("Documents tab (Mongo API)", () => {
});
it("clicking Delete Document asks for confirmation", () => {
const mockDeleteDocument = deleteDocument as jest.Mock;
mockDeleteDocument.mockClear();
const mockDeleteDocuments = deleteDocuments as jest.Mock;
mockDeleteDocuments.mockClear();
act(() => {
useCommandBar
@@ -189,7 +189,7 @@ describe("Documents tab (Mongo API)", () => {
.onCommandClick(undefined);
});
expect(mockDeleteDocument).toHaveBeenCalled();
expect(mockDeleteDocuments).toHaveBeenCalled();
});
});
});