Fix unit tests

This commit is contained in:
Laurent Nguyen 2024-08-22 14:24:44 +02:00
parent c9398e303b
commit a2556dad06
2 changed files with 52 additions and 1139 deletions

View File

@ -486,7 +486,7 @@ export const buildQuery = (
filter,
partitionKeyProperties,
partitionKey,
additionalField.filter((f) => !f.startsWith("/")),
additionalField?.filter((f) => !f.startsWith("/")) || [],
);
};
@ -987,15 +987,15 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
const deletePromise = !isPreferredApiMongoDB
? _deleteNoSqlDocuments(_collection, toDeleteDocumentIds)
: MongoProxyClient.deleteDocuments(
_collection.databaseId,
_collection as ViewModels.Collection,
toDeleteDocumentIds,
).then(({ deletedCount, isAcknowledged }) => {
if (deletedCount === toDeleteDocumentIds.length && isAcknowledged) {
return toDeleteDocumentIds;
}
throw new Error(`Delete failed with deletedCount: ${deletedCount} and isAcknowledged: ${isAcknowledged}`);
});
_collection.databaseId,
_collection as ViewModels.Collection,
toDeleteDocumentIds,
).then(({ deletedCount, isAcknowledged }) => {
if (deletedCount === toDeleteDocumentIds.length && isAcknowledged) {
return toDeleteDocumentIds;
}
throw new Error(`Delete failed with deletedCount: ${deletedCount} and isAcknowledged: ${isAcknowledged}`);
});
return deletePromise
.then(
@ -1068,8 +1068,8 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
? `the selected ${selectedRows.size} items`
: "the selected item"
: isPlural
? `the selected ${selectedRows.size} documents`
: "the selected document";
? `the selected ${selectedRows.size} documents`
: "the selected document";
const msg = `Are you sure you want to delete ${documentName}?`;
useDialog