Skip to content

Commit b701d5d

Browse files
refactor(NODE-3717): test reorganization part 6 (#3090)
1 parent 7bb9e37 commit b701d5d

12 files changed

+336
-544
lines changed

docs/editor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Here's a quick description of each:
4949
"files.trimFinalNewlines": true,
5050
"files.insertFinalNewline": true,
5151
// Testing settings
52-
"mochaExplorer.files": "test/unit/**/*.test.js",
52+
"mochaExplorer.files": "test/unit/**/*.test.*",
5353
"mochaExplorer.ui": "test/tools/runner/metadata_ui.js",
5454
"mochaExplorer.envPath": null, // Useful for more advanced tests
5555
// Typescript settings

test/functional/aggregation.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,8 +1120,7 @@ describe('Aggregation', function () {
11201120
metadata: {
11211121
requires: {
11221122
mongodb: '>=3.5.0',
1123-
topology: 'single',
1124-
node: '>=4.8.5'
1123+
topology: 'single'
11251124
}
11261125
},
11271126
test: function (done) {

test/functional/cursor_async_iterator.test.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,16 @@ describe('Cursor Async Iterator Tests', function () {
4141
expect(counter).to.equal(1000);
4242
});
4343

44-
it('should be able to use a for-await loop on an aggregation cursor', {
45-
metadata: { requires: { node: '>=10.5.0' } },
46-
test: async function () {
47-
const cursor = collection.aggregate([{ $match: { bar: 1 } }]);
48-
49-
let counter = 0;
50-
for await (const doc of cursor) {
51-
expect(doc).to.have.property('bar', 1);
52-
counter += 1;
53-
}
44+
it('should be able to use a for-await loop on an aggregation cursor', async function () {
45+
const cursor = collection.aggregate([{ $match: { bar: 1 } }]);
5446

55-
expect(counter).to.equal(1000);
47+
let counter = 0;
48+
for await (const doc of cursor) {
49+
expect(doc).to.have.property('bar', 1);
50+
counter += 1;
5651
}
52+
53+
expect(counter).to.equal(1000);
5754
});
5855

5956
it('should be able to use a for-await loop on a command cursor', {

test/functional/deprecate_warning.test.js

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict';
2-
const exec = require('child_process').exec;
32
const chai = require('chai');
43

54
const expect = chai.expect;
@@ -21,71 +20,6 @@ describe('Deprecation Warnings - functional', function () {
2120
this.sinon.stub(console, 'error');
2221
});
2322

24-
const defaultMessage = ' is deprecated and will be removed in a later version.';
25-
it.skip('node --no-deprecation flag should suppress all deprecation warnings', {
26-
metadata: { requires: { node: '>=6.0.0' } },
27-
test: function (done) {
28-
exec(
29-
'node --no-deprecation ./test/tools/deprecate_warning_test_program.js',
30-
(err, stdout, stderr) => {
31-
expect(err).to.not.exist;
32-
expect(stdout).to.be.empty;
33-
expect(stderr).to.be.empty;
34-
done();
35-
}
36-
);
37-
}
38-
});
39-
40-
it.skip('node --trace-deprecation flag should print stack trace to stderr', {
41-
metadata: { requires: { node: '>=6.0.0' } },
42-
test: function (done) {
43-
exec(
44-
'node --trace-deprecation ./test/tools/deprecate_warning_test_program.js',
45-
(err, stdout, stderr) => {
46-
expect(err).to.not.exist;
47-
expect(stdout).to.be.empty;
48-
expect(stderr).to.not.be.empty;
49-
50-
// split stderr into separate lines, trimming the first line to just the warning message
51-
const split = stderr.split('\n');
52-
const warning = split.shift().split(')')[1].trim();
53-
54-
// ensure warning message matches expected
55-
expect(warning).to.equal(
56-
'DeprecationWarning: testDeprecationFlags option [maxScan]' + defaultMessage
57-
);
58-
59-
// ensure each following line is from the stack trace, i.e. 'at config.deprecatedOptions.forEach.deprecatedOption'
60-
split.pop();
61-
split.forEach(s => {
62-
expect(s.trim()).to.match(/^at/);
63-
});
64-
65-
done();
66-
}
67-
);
68-
}
69-
});
70-
71-
it.skip('node --throw-deprecation flag should throw error when deprecated function is called', {
72-
metadata: { requires: { node: '>=6.0.0' } },
73-
test: function (done) {
74-
exec(
75-
'node --throw-deprecation ./test/tools/deprecate_warning_test_program.js this_arg_should_never_print',
76-
(err, stdout, stderr) => {
77-
expect(stderr).to.not.be.empty;
78-
expect(err).to.not.exist;
79-
expect(err).to.have.own.property('code').that.equals(1);
80-
81-
// ensure stdout is empty, i.e. that the program threw an error before reaching the console.log statement
82-
expect(stdout).to.be.empty;
83-
done();
84-
}
85-
);
86-
}
87-
});
88-
8923
it('test behavior for classes with an associated logger', function () {
9024
const fakeClass = new ClassWithLogger();
9125
const logger = fakeClass.getLogger();

test/functional/saslprep.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ describe('SASLPrep', function () {
7070
it(`should be able to login with username "${username}" and password "${password}"`, {
7171
metadata: {
7272
requires: {
73-
mongodb: '>=3.7.3',
74-
node: '>=6'
73+
mongodb: '>=3.7.3'
7574
}
7675
},
7776
test: function () {

test/functional/unit_bypass_validation.test.js

Lines changed: 0 additions & 238 deletions
This file was deleted.

0 commit comments

Comments
 (0)