Skip to content

Commit 77ab63e

Browse files
authored
test(NODE-3387): correctly extract findOneX values in unified operations (#2966)
1 parent 96c8ab4 commit 77ab63e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/functional/unified-spec-runner/operations.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ operations.set('find', async ({ entities, operation }) => {
309309
operations.set('findOneAndReplace', async ({ entities, operation }) => {
310310
const collection = entities.getEntity('collection', operation.object);
311311
const { filter, replacement, ...opts } = operation.arguments;
312-
return collection.findOneAndReplace(filter, replacement, translateOptions(opts));
312+
return (await collection.findOneAndReplace(filter, replacement, translateOptions(opts))).value;
313313
});
314314

315315
operations.set('findOneAndUpdate', async ({ entities, operation }) => {
@@ -318,6 +318,12 @@ operations.set('findOneAndUpdate', async ({ entities, operation }) => {
318318
return (await collection.findOneAndUpdate(filter, update, translateOptions(opts))).value;
319319
});
320320

321+
operations.set('findOneAndDelete', async ({ entities, operation }) => {
322+
const collection = entities.getEntity('collection', operation.object);
323+
const { filter, ...opts } = operation.arguments;
324+
return (await collection.findOneAndDelete(filter, opts)).value;
325+
});
326+
321327
operations.set('failPoint', async ({ entities, operation }) => {
322328
const client = entities.getEntity('client', operation.arguments.client);
323329
return entities.failPoints.enableFailPoint(client, operation.arguments.failPoint);
@@ -467,11 +473,6 @@ operations.set('estimatedDocumentCount', async ({ entities, operation }) => {
467473
return collection.estimatedDocumentCount(operation.arguments);
468474
});
469475

470-
operations.set('findOneAndDelete', async ({ entities, operation }) => {
471-
const collection = entities.getEntity('collection', operation.object);
472-
return collection.findOneAndDelete(operation.arguments.filter);
473-
});
474-
475476
operations.set('runCommand', async ({ entities, operation }: OperationFunctionParams) => {
476477
const db = entities.getEntity('db', operation.object);
477478
return db.command(operation.arguments.command);

0 commit comments

Comments
 (0)