Skip to content

Commit

Permalink
test: lowercase returnDocument for spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dariakp committed May 12, 2021
1 parent 76bee11 commit 52f5ef4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions test/functional/crud_spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ describe('CRUD spec', function () {
const filter = args.filter;
const second = args.update || args.replacement;
const options = Object.assign({}, args);
if (options.returnDocument) {
options.returnDocument = options.returnDocument.toLowerCase();
}

delete options.filter;
delete options.update;
Expand Down
6 changes: 4 additions & 2 deletions test/functional/retryable_writes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ function generateArguments(test) {
Object.keys(test.operation.arguments).forEach(arg => {
if (arg === 'requests') {
args.push(test.operation.arguments[arg].map(convertBulkWriteOperation));
} else if (arg === 'upsert' || arg === 'returnDocument') {
options[arg] = test.operation.arguments[arg];
} else if (arg === 'upsert') {
options.upsert = test.operation.arguments[arg];
} else if (arg === 'returnDocument') {
options.returnDocument = test.operation.arguments[arg].toLowerCase();
} else {
args.push(test.operation.arguments[arg]);
}
Expand Down
4 changes: 4 additions & 0 deletions test/functional/spec-runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,10 @@ function testOperation(operation, obj, context, options) {
return;
}

if (key === 'returnDocument') {
opOptions.returnDocument = operation.arguments[key].toLowerCase();
}

if (key === 'options') {
Object.assign(opOptions, operation.arguments[key]);
if (opOptions.readPreference) {
Expand Down

0 comments on commit 52f5ef4

Please sign in to comment.