Fix bug with markup. Simplify code.

This commit is contained in:
Laurent Nguyen
2024-05-16 09:47:40 +02:00
parent 6dd02c0e51
commit 04989c6e1b
4 changed files with 12 additions and 10 deletions

View File

@@ -64,11 +64,17 @@ export const deleteDocuments = async (collection: CollectionBase, documentIds: D
const allResult = await Promise.all(promiseArray); const allResult = await Promise.all(promiseArray);
const flatAllResult = Array.prototype.concat.apply([], allResult); const flatAllResult = Array.prototype.concat.apply([], allResult);
logConsoleInfo(`Successfully deleted ${getEntityName(flatAllResult.length > 1)}: ${flatAllResult.length} out of ${nbDocuments}`); logConsoleInfo(
`Successfully deleted ${getEntityName(flatAllResult.length > 1)}: ${flatAllResult.length} out of ${nbDocuments}`,
);
// TODO: handle case result.length != nbDocuments // TODO: handle case result.length != nbDocuments
return flatAllResult; return flatAllResult;
} catch (error) { } catch (error) {
handleError(error, "DeleteDocuments", `Error while deleting ${documentIds.length} ${getEntityName(documentIds.length > 1)}`); handleError(
error,
"DeleteDocuments",
`Error while deleting ${documentIds.length} ${getEntityName(documentIds.length > 1)}`,
);
throw error; throw error;
} finally { } finally {
clearMessage(); clearMessage();

View File

@@ -147,7 +147,7 @@ describe("Documents tab (Mongo API)", () => {
}); });
it("renders by default the first document", async () => { it("renders by default the first document", async () => {
// expect(wrapper.findWhere((node) => node.text().includes(PROPERTY_VALUE)).exists()).toBeTruthy(); expect(wrapper.findWhere((node) => node.text().includes(PROPERTY_VALUE)).exists()).toBeTruthy();
}); });
it("default buttons", async () => { it("default buttons", async () => {

View File

@@ -13,12 +13,8 @@ describe("DocumentsTableComponent", () => {
{ [ID_HEADER]: "2", [PARTITION_KEY_HEADER]: "pk2" }, { [ID_HEADER]: "2", [PARTITION_KEY_HEADER]: "pk2" },
{ [ID_HEADER]: "3", [PARTITION_KEY_HEADER]: "pk3" }, { [ID_HEADER]: "3", [PARTITION_KEY_HEADER]: "pk3" },
], ],
onItemClicked: (index: number): void => { onItemClicked: (): void => {},
index; onSelectedRowsChange: (): void => {},
},
onSelectedRowsChange: (selectedItemsIndices: Set<TableRowId>): void => {
selectedItemsIndices;
},
selectedRows: new Set<TableRowId>(), selectedRows: new Set<TableRowId>(),
size: { size: {
height: 0, height: 0,