Skip to content

Commit 50c6726

Browse files
committed
eslint
1 parent 0b99934 commit 50c6726

File tree

1 file changed

+69
-69
lines changed

1 file changed

+69
-69
lines changed

test/unit-tests/db.tests.js

+69-69
Original file line numberDiff line numberDiff line change
@@ -29,38 +29,38 @@ function runTest(options) {
2929
console.log(JSON.stringify(res));
3030

3131

32-
if(options.options.remove){
33-
res = res ||{};
34-
if(options.query._id){
35-
res.should.have.property("_id", options.query._id);
36-
}
37-
else {
38-
res.should.have.property("_id");
39-
}
32+
if (options.options.remove) {
33+
res = res || {};
34+
if (options.query._id) {
35+
res.should.have.property("_id", options.query._id);
36+
}
37+
else {
38+
res.should.have.property("_id");
39+
}
4040

41-
if(options.query.name){
42-
res.should.have.property("name", options.query.name);
43-
}
44-
else {
45-
res.should.have.property("name");
46-
}
47-
}
48-
else {
49-
res.should.have.property("value");
50-
if (options.options.new) {
51-
if (options.update.$set.name) {
52-
res.value.should.have.property("name", options.update.$set.name);
53-
}
54-
}
55-
else {
56-
if (options.query.name) {
57-
res.value.should.have.property("name", options.query.name);
58-
}
59-
}
60-
if (options.query._id) {
61-
res.value.should.have.property("_id", options.query._id);
62-
}
63-
}
41+
if (options.query.name) {
42+
res.should.have.property("name", options.query.name);
43+
}
44+
else {
45+
res.should.have.property("name");
46+
}
47+
}
48+
else {
49+
res.should.have.property("value");
50+
if (options.options.new) {
51+
if (options.update.$set.name) {
52+
res.value.should.have.property("name", options.update.$set.name);
53+
}
54+
}
55+
else {
56+
if (options.query.name) {
57+
res.value.should.have.property("name", options.query.name);
58+
}
59+
}
60+
if (options.query._id) {
61+
res.value.should.have.property("_id", options.query._id);
62+
}
63+
}
6464
done();
6565
});
6666
}
@@ -123,38 +123,38 @@ function runTest(options) {
123123
var res = await db.collection("testCommands2").findAndModify(options.query, options.sort || [], options.update, options.options);
124124
console.log(" " + JSON.stringify(res));
125125

126-
if(options.options.remove){
127-
if(options.query._id){
128-
res.should.have.property("_id", options.query._id);
129-
}
130-
else {
131-
res.should.have.property("_id");
132-
}
126+
if (options.options.remove) {
127+
if (options.query._id) {
128+
res.should.have.property("_id", options.query._id);
129+
}
130+
else {
131+
res.should.have.property("_id");
132+
}
133133

134-
if(options.query.name){
135-
res.should.have.property("name", options.query.name);
136-
}
137-
else {
138-
res.should.have.property("name");
139-
}
140-
}
141-
else {
142-
res.should.have.property("value");
143-
if (options.options.new) {
144-
res.value.should.have.property("name", options.update.$set.name);
145-
}
146-
else {
147134
if (options.query.name) {
148-
res.value.should.have.property("name", options.query.name);
135+
res.should.have.property("name", options.query.name);
136+
}
137+
else {
138+
res.should.have.property("name");
149139
}
150-
}
151-
if (options.query._id) {
152-
res.value.should.have.property("_id", options.query._id);
153140
}
154141
else {
155-
res.value.should.have.property("_id");
142+
res.should.have.property("value");
143+
if (options.options.new) {
144+
res.value.should.have.property("name", options.update.$set.name);
145+
}
146+
else {
147+
if (options.query.name) {
148+
res.value.should.have.property("name", options.query.name);
149+
}
150+
}
151+
if (options.query._id) {
152+
res.value.should.have.property("_id", options.query._id);
153+
}
154+
else {
155+
res.value.should.have.property("_id");
156+
}
156157
}
157-
}
158158

159159
}
160160
else {
@@ -192,17 +192,17 @@ function runTest(options) {
192192
describe('Testing Simple database operations', function() {
193193

194194
describe('Setting up db connection', function() {
195-
before('Create db connection', async function() {
196-
testUtils.db = await plugins.dbConnection("countly");
197-
testUtils.client = testUtils.db.client;
198-
});
195+
before('Create db connection', async function() {
196+
testUtils.db = await plugins.dbConnection("countly");
197+
testUtils.client = testUtils.db.client;
198+
});
199199
it('Setting db', function(done) {
200200
db = testUtils.client.db("countly");
201201
done();
202202
});
203203
});
204204

205-
describe('Cleanup', function() {
205+
describe('Cleanup', function() {
206206
it('should remove collection with callback', function(done) {
207207
db.collection("testCommands").drop(function(err, res) {
208208
if (err) {
@@ -244,8 +244,8 @@ describe('Testing Simple database operations', function() {
244244
describe('Find and modify upsert:false,new:false', function() {
245245
runTest({"op": "findAndModify", query: { name: "test" }, "update": { $set: { name: "test2" } }, "options": { new: false }});
246246
});
247-
describe('Find and modify remove:true', function() {
248-
runTest({"op": "findAndModify", query: { _id:"aaaaa" }, "update": {}, "options": { remove: true }});
247+
describe('Find and modify remove:true', function() {
248+
runTest({"op": "findAndModify", query: { _id: "aaaaa" }, "update": {}, "options": { remove: true }});
249249
});
250250
});
251251

@@ -265,10 +265,10 @@ describe('Testing Simple database operations', function() {
265265
});
266266
it("test cursor using await and going next()", async function() {
267267
var cursor = await db.collection("testCommands2").find({});
268-
var doc = await cursor.next();
268+
var doc = await cursor.next();
269269
while (doc) {
270-
doc.should.have.property("_id");
271-
doc.should.have.property("name");
270+
doc.should.have.property("_id");
271+
doc.should.have.property("name");
272272
doc = await cursor.next();
273273
}
274274
});
@@ -283,15 +283,15 @@ describe('Testing Simple database operations', function() {
283283
console.log(err);
284284
}
285285
res.should.be.true;
286-
done();
286+
done();
287287
});
288288

289289
});
290290
it('should remove collection with promise', async function() {
291291
var res = await db.collection("testCommands2").drop();
292292
res.should.be.true;
293293
});
294-
after('Close db connection', async function() {
294+
after('Close db connection', async function() {
295295
testUtils.client.close();
296296
});
297297
});

0 commit comments

Comments
 (0)