Skip to content

Commit 9f5fd14

Browse files
committed
fixed const issues
1 parent c31092e commit 9f5fd14

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

test/functional/crud_spec_tests.js

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ exports['Execute all read crud specification tests'] = {
88
test: function(configuration, test) {
99
co(function*() {
1010
// Create db connection
11-
const MongoClient = configuration.require.MongoClient;
12-
const db = yield MongoClient.connect(configuration.url());
11+
var MongoClient = configuration.require.MongoClient;
12+
var db = yield MongoClient.connect(configuration.url());
1313

1414
console.log("== Execute CRUD read specifications");
1515

1616
// Read and parse all the tests cases
17-
const scenarios = fs.readdirSync(`${__dirname}/crud/read`).filter(x => {
17+
var scenarios = fs.readdirSync(`${__dirname}/crud/read`).filter(x => {
1818
return x.indexOf('json') != -1;
1919
}).map(x => {
2020
return fs.readFileSync(`${__dirname}/crud/read/${x}`, 'utf8');
2121
}).map(x => {
2222
return JSON.parse(x);
2323
});
2424

25-
for(const scenario of scenarios) {
25+
for(var scenario of scenarios) {
2626
yield executeScenario(scenario, configuration, db, test);
2727
}
2828

@@ -37,21 +37,21 @@ exports['Execute all write crud specification tests'] = {
3737
test: function(configuration, test) {
3838
co(function*() {
3939
// Create db connection
40-
const MongoClient = configuration.require.MongoClient;
41-
const db = yield MongoClient.connect(configuration.url());
40+
var MongoClient = configuration.require.MongoClient;
41+
var db = yield MongoClient.connect(configuration.url());
4242

4343
console.log("== Execute CRUD read specifications");
4444

4545
// Read and parse all the tests cases
46-
const scenarios = fs.readdirSync(`${__dirname}/crud/write`).filter(x => {
46+
var scenarios = fs.readdirSync(`${__dirname}/crud/write`).filter(x => {
4747
return x.indexOf('json') != -1;
4848
}).map(x => {
4949
return fs.readFileSync(`${__dirname}/crud/write/${x}`, 'utf8');
5050
}).map(x => {
5151
return JSON.parse(x);
5252
});
5353

54-
for(const scenario of scenarios) {
54+
for(var scenario of scenarios) {
5555
yield executeScenario(scenario, configuration, db, test);
5656
}
5757

@@ -63,16 +63,16 @@ exports['Execute all write crud specification tests'] = {
6363
function executeScenario(scenario, configuration, db, test) {
6464
return new Promise((resolve, reject) => {
6565
co(function*() {
66-
const buildInfo = yield db.admin().command({buildInfo:true});
67-
const mongodbVersion = buildInfo.version.split('-').shift();
68-
const requiredMongodbVersion = scenario.minServerVersion;
69-
const collection = db.collection('crud_spec_tests');
66+
var buildInfo = yield db.admin().command({buildInfo:true});
67+
var mongodbVersion = buildInfo.version.split('-').shift();
68+
var requiredMongodbVersion = scenario.minServerVersion;
69+
var collection = db.collection('crud_spec_tests');
7070

7171
// Do we satisfy semver
7272
if (semver.satisfies(mongodbVersion, `>=${requiredMongodbVersion}`) || !requiredMongodbVersion) {
73-
for (const scenarioTest of scenario.tests) {
74-
const description = scenarioTest.description;
75-
const name = scenarioTest.operation.name;
73+
for (var scenarioTest of scenario.tests) {
74+
var description = scenarioTest.description;
75+
var name = scenarioTest.operation.name;
7676

7777
console.log(` execute test [${description}]`);
7878

@@ -91,18 +91,18 @@ function executeScenario(scenario, configuration, db, test) {
9191
}
9292

9393
if (name === 'aggregate') {
94-
const options = {};
94+
var options = {};
9595
if (scenarioTest.operation.arguments.collation) {
9696
options.collation = scenarioTest.operation.arguments.collation;
9797
}
9898

99-
const results = yield collection[name](
99+
var results = yield collection[name](
100100
scenarioTest.operation.arguments.pipeline, options
101101
)
102102
.toArray();
103103

104104
if(scenarioTest.outcome.collection) {
105-
const collectionResults = yield db
105+
var collectionResults = yield db
106106
.collection(scenarioTest.outcome.collection.name)
107107
.find({})
108108
.toArray();
@@ -111,99 +111,99 @@ function executeScenario(scenario, configuration, db, test) {
111111
test.deepEqual(scenarioTest.outcome.result, results);
112112
}
113113
} else if (name == 'count') {
114-
const arguments = scenarioTest.operation.arguments;
115-
const filter = arguments.filter;
116-
const options = Object.assign({}, arguments);
114+
var arguments = scenarioTest.operation.arguments;
115+
var filter = arguments.filter;
116+
var options = Object.assign({}, arguments);
117117
delete options.filter;
118118

119-
const result = yield collection.count(filter, options);
119+
var result = yield collection.count(filter, options);
120120
test.equal(scenarioTest.outcome.result, result);
121121
} else if (name == 'distinct') {
122-
const arguments = scenarioTest.operation.arguments;
123-
const fieldName = arguments.fieldName;
124-
const options = Object.assign({}, arguments);
125-
const filter = arguments.filter || {};
122+
var arguments = scenarioTest.operation.arguments;
123+
var fieldName = arguments.fieldName;
124+
var options = Object.assign({}, arguments);
125+
var filter = arguments.filter || {};
126126
delete options.fieldName;
127127
delete options.filter;
128128

129-
const result = yield collection.distinct(fieldName, filter, options);
129+
var result = yield collection.distinct(fieldName, filter, options);
130130
test.deepEqual(scenarioTest.outcome.result, result);
131131
} else if (name == 'find') {
132-
const arguments = scenarioTest.operation.arguments;
133-
const filter = arguments.filter;
134-
const options = Object.assign({}, arguments);
132+
var arguments = scenarioTest.operation.arguments;
133+
var filter = arguments.filter;
134+
var options = Object.assign({}, arguments);
135135
delete options.filter;
136136

137-
const results = yield collection.find(filter, options).toArray();
137+
var results = yield collection.find(filter, options).toArray();
138138
test.deepEqual(scenarioTest.outcome.result, results);
139139
} else if (name == 'deleteMany' || name == 'deleteOne') {
140140
// Unpack the scenario test
141-
const arguments = scenarioTest.operation.arguments;
142-
const filter = arguments.filter;
143-
const options = Object.assign({}, arguments);
141+
var arguments = scenarioTest.operation.arguments;
142+
var filter = arguments.filter;
143+
var options = Object.assign({}, arguments);
144144
delete options.filter;
145145

146146
// Get the results
147-
const result = yield collection[scenarioTest.operation.name](filter, options);
147+
var result = yield collection[scenarioTest.operation.name](filter, options);
148148

149149
// Go over the results
150-
for (const name in scenarioTest.outcome.result) {
150+
for (var name in scenarioTest.outcome.result) {
151151
test.equal(scenarioTest.outcome.result[name], result[name]);
152152
}
153153

154154
if (scenarioTest.outcome.collection) {
155-
const results = yield collection.find({}).toArray();
155+
var results = yield collection.find({}).toArray();
156156
test.deepEqual(scenarioTest.outcome.collection.data, results);
157157
}
158158
} else if (name == 'replaceOne') {
159159
// Unpack the scenario test
160-
const arguments = scenarioTest.operation.arguments;
161-
const filter = arguments.filter;
162-
const replacement = arguments.replacement;
163-
const options = Object.assign({}, arguments);
160+
var arguments = scenarioTest.operation.arguments;
161+
var filter = arguments.filter;
162+
var replacement = arguments.replacement;
163+
var options = Object.assign({}, arguments);
164164
delete options.filter;
165165
delete options.replacement;
166166

167167
// Get the results
168-
const result = yield collection[scenarioTest.operation.name](filter, replacement, options);
168+
var result = yield collection[scenarioTest.operation.name](filter, replacement, options);
169169

170170
// Go over the results
171-
for (const name in scenarioTest.outcome.result) {
171+
for (var name in scenarioTest.outcome.result) {
172172
test.equal(scenarioTest.outcome.result[name], result[name]);
173173
}
174174

175175
if (scenarioTest.outcome.collection) {
176-
const results = yield collection.find({}).toArray();
176+
var results = yield collection.find({}).toArray();
177177
test.deepEqual(scenarioTest.outcome.collection.data, results);
178178
}
179179
} else if (name == 'updateOne' || name == 'updateMany') {
180180
// Unpack the scenario test
181-
const arguments = scenarioTest.operation.arguments;
182-
const filter = arguments.filter;
183-
const update = arguments.update;
184-
const options = Object.assign({}, arguments);
181+
var arguments = scenarioTest.operation.arguments;
182+
var filter = arguments.filter;
183+
var update = arguments.update;
184+
var options = Object.assign({}, arguments);
185185
delete options.filter;
186186
delete options.update;
187187

188188
// Get the results
189-
const result = yield collection[scenarioTest.operation.name](filter, update, options);
189+
var result = yield collection[scenarioTest.operation.name](filter, update, options);
190190

191191
// Go over the results
192-
for (const name in scenarioTest.outcome.result) {
192+
for (var name in scenarioTest.outcome.result) {
193193
test.equal(scenarioTest.outcome.result[name], result[name]);
194194
}
195195

196196
if (scenarioTest.outcome.collection) {
197-
const results = yield collection.find({}).toArray();
197+
var results = yield collection.find({}).toArray();
198198
test.deepEqual(scenarioTest.outcome.collection.data, results);
199199
}
200200
} else if (name == 'findOneAndReplace'
201201
|| name == 'findOneAndUpdate' || name == 'findOneAndDelete') {
202202
// Unpack the scenario test
203-
const arguments = scenarioTest.operation.arguments;
204-
const filter = arguments.filter;
205-
const second = arguments.update || arguments.replacement;
206-
const options = Object.assign({}, arguments);
203+
var arguments = scenarioTest.operation.arguments;
204+
var filter = arguments.filter;
205+
var second = arguments.update || arguments.replacement;
206+
var options = Object.assign({}, arguments);
207207
if (options.returnDocument) {
208208
options.returnOriginal = options.returnDocument == 'After' ? false : true;
209209
}
@@ -224,7 +224,7 @@ function executeScenario(scenario, configuration, db, test) {
224224
}
225225

226226
if (scenarioTest.outcome.collection) {
227-
const results = yield collection.find({}).toArray();
227+
var results = yield collection.find({}).toArray();
228228
test.deepEqual(scenarioTest.outcome.collection.data, results);
229229
}
230230
}
@@ -233,7 +233,7 @@ function executeScenario(scenario, configuration, db, test) {
233233

234234
resolve();
235235
}).catch(err => {
236-
console.log(err)
236+
console.log(err.stack)
237237
reject(err);
238238
});
239239
});

0 commit comments

Comments
 (0)