Skip to content

Commit

Permalink
test(NODE-3387): correctly extract findOneX values in unified operati…
Browse files Browse the repository at this point in the history
…ons (#2966)
  • Loading branch information
dariakp committed Aug 31, 2021
1 parent 96c8ab4 commit 77ab63e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/functional/unified-spec-runner/operations.ts
Expand Up @@ -309,7 +309,7 @@ operations.set('find', async ({ entities, operation }) => {
operations.set('findOneAndReplace', async ({ entities, operation }) => {
const collection = entities.getEntity('collection', operation.object);
const { filter, replacement, ...opts } = operation.arguments;
return collection.findOneAndReplace(filter, replacement, translateOptions(opts));
return (await collection.findOneAndReplace(filter, replacement, translateOptions(opts))).value;
});

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

operations.set('findOneAndDelete', async ({ entities, operation }) => {
const collection = entities.getEntity('collection', operation.object);
const { filter, ...opts } = operation.arguments;
return (await collection.findOneAndDelete(filter, opts)).value;
});

operations.set('failPoint', async ({ entities, operation }) => {
const client = entities.getEntity('client', operation.arguments.client);
return entities.failPoints.enableFailPoint(client, operation.arguments.failPoint);
Expand Down Expand Up @@ -467,11 +473,6 @@ operations.set('estimatedDocumentCount', async ({ entities, operation }) => {
return collection.estimatedDocumentCount(operation.arguments);
});

operations.set('findOneAndDelete', async ({ entities, operation }) => {
const collection = entities.getEntity('collection', operation.object);
return collection.findOneAndDelete(operation.arguments.filter);
});

operations.set('runCommand', async ({ entities, operation }: OperationFunctionParams) => {
const db = entities.getEntity('db', operation.object);
return db.command(operation.arguments.command);
Expand Down

0 comments on commit 77ab63e

Please sign in to comment.