Skip to content

Commit 52f5ef4

Browse files
committed
test: lowercase returnDocument for spec tests
1 parent 76bee11 commit 52f5ef4

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

test/functional/crud_spec.test.js

+3
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ describe('CRUD spec', function () {
320320
const filter = args.filter;
321321
const second = args.update || args.replacement;
322322
const options = Object.assign({}, args);
323+
if (options.returnDocument) {
324+
options.returnDocument = options.returnDocument.toLowerCase();
325+
}
323326

324327
delete options.filter;
325328
delete options.update;

test/functional/retryable_writes.test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ function generateArguments(test) {
136136
Object.keys(test.operation.arguments).forEach(arg => {
137137
if (arg === 'requests') {
138138
args.push(test.operation.arguments[arg].map(convertBulkWriteOperation));
139-
} else if (arg === 'upsert' || arg === 'returnDocument') {
140-
options[arg] = test.operation.arguments[arg];
139+
} else if (arg === 'upsert') {
140+
options.upsert = test.operation.arguments[arg];
141+
} else if (arg === 'returnDocument') {
142+
options.returnDocument = test.operation.arguments[arg].toLowerCase();
141143
} else {
142144
args.push(test.operation.arguments[arg]);
143145
}

test/functional/spec-runner/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,10 @@ function testOperation(operation, obj, context, options) {
680680
return;
681681
}
682682

683+
if (key === 'returnDocument') {
684+
opOptions.returnDocument = operation.arguments[key].toLowerCase();
685+
}
686+
683687
if (key === 'options') {
684688
Object.assign(opOptions, operation.arguments[key]);
685689
if (opOptions.readPreference) {

0 commit comments

Comments
 (0)