Skip to content

Commit

Permalink
style: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Sep 13, 2018
1 parent dcfb894 commit 2d928b4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
9 changes: 3 additions & 6 deletions test/connection.test.js
Expand Up @@ -106,13 +106,12 @@ describe('connections:', function() {
it('disconnected (gh-5498) (gh-5524)', function(done) {
this.timeout(60000);

let conn;
let numConnected = 0;
let numDisconnected = 0;
let numReconnected = 0;
let numReconnect = 0;
let numClose = 0;
conn = mongoose.createConnection('mongodb://localhost:27000/mongoosetest', { useNewUrlParser: true });
const conn = mongoose.createConnection('mongodb://localhost:27000/mongoosetest', { useNewUrlParser: true });

conn.on('connected', function() {
++numConnected;
Expand Down Expand Up @@ -172,12 +171,11 @@ describe('connections:', function() {
it('reconnectFailed (gh-4027)', function(done) {
this.timeout(60000);

let conn;
let numReconnectFailed = 0;
let numConnected = 0;
let numDisconnected = 0;
let numReconnected = 0;
conn = mongoose.createConnection('mongodb://localhost:27000/mongoosetest', {
const conn = mongoose.createConnection('mongodb://localhost:27000/mongoosetest', {
reconnectTries: 3,
reconnectInterval: 100,
useNewUrlParser: true
Expand Down Expand Up @@ -243,10 +241,9 @@ describe('connections:', function() {
it('timeout (gh-4513)', function(done) {
this.timeout(60000);

let conn;
let numTimeout = 0;
let numDisconnected = 0;
conn = mongoose.createConnection('mongodb://localhost:27000/mongoosetest', {
const conn = mongoose.createConnection('mongodb://localhost:27000/mongoosetest', {
socketTimeoutMS: 100,
poolSize: 1,
useNewUrlParser: true
Expand Down
41 changes: 24 additions & 17 deletions test/document.modified.test.js
Expand Up @@ -4,7 +4,14 @@

'use strict';

let start = require('./common'), assert = require('power-assert'), mongoose = start.mongoose, random = require('../lib/utils').random, Schema = mongoose.Schema, ObjectId = Schema.ObjectId, DocumentObjectId = mongoose.Types.ObjectId;
const assert = require('assert');
const random = require('../lib/utils').random;
const start = require('./common');

const mongoose = start.mongoose;
const Schema = mongoose.Schema;
const ObjectId = Schema.ObjectId;
const DocumentObjectId = mongoose.Types.ObjectId;

/**
* Setup.
Expand Down Expand Up @@ -82,8 +89,8 @@ describe('document modified', function() {

describe('modified states', function() {
it('reset after save', function(done) {
let B = db.model(modelName, collection),
b = new B;
const B = db.model(modelName, collection);
const b = new B;

b.numbers.push(3);
b.save(function(err) {
Expand All @@ -104,8 +111,8 @@ describe('document modified', function() {
});

it('of embedded docs reset after save', function(done) {
let BlogPost = db.model(modelName, collection),
post = new BlogPost({title: 'hocus pocus'});
const BlogPost = db.model(modelName, collection);
const post = new BlogPost({title: 'hocus pocus'});
post.comments.push({title: 'Humpty Dumpty', comments: [{title: 'nested'}]});
post.save(function(err) {
assert.strictEqual(null, err);
Expand Down Expand Up @@ -144,8 +151,8 @@ describe('document modified', function() {
});

it('when modifying keys', function(done) {
let BlogPost = db.model(modelName, collection),
post = new BlogPost;
const BlogPost = db.model(modelName, collection);
const post = new BlogPost;
post.init({
title: 'Test',
slug: 'test',
Expand Down Expand Up @@ -182,8 +189,8 @@ describe('document modified', function() {

describe('on DocumentArray', function() {
it('work', function(done) {
let BlogPost = db.model(modelName, collection),
post = new BlogPost();
const BlogPost = db.model(modelName, collection);
const post = new BlogPost();
post.init({
title: 'Test',
slug: 'test',
Expand All @@ -200,8 +207,8 @@ describe('document modified', function() {
done();
});
it('with accessors', function(done) {
let BlogPost = db.model(modelName, collection),
post = new BlogPost();
const BlogPost = db.model(modelName, collection);
const post = new BlogPost();
post.init({
title: 'Test',
slug: 'test',
Expand All @@ -222,17 +229,17 @@ describe('document modified', function() {
describe('on MongooseArray', function() {
it('atomic methods', function(done) {
// COMPLETEME
let BlogPost = db.model(modelName, collection),
post = new BlogPost();
const BlogPost = db.model(modelName, collection);
const post = new BlogPost();
assert.equal(post.isModified('owners'), false);
post.get('owners').push(new DocumentObjectId);
assert.equal(post.isModified('owners'), true);
done();
});
it('native methods', function(done) {
// COMPLETEME
let BlogPost = db.model(modelName, collection),
post = new BlogPost;
const BlogPost = db.model(modelName, collection);
const post = new BlogPost;
assert.equal(post.isModified('owners'), false);
done();
});
Expand Down Expand Up @@ -535,8 +542,8 @@ describe('document modified', function() {
});

it('should reset the modified state after calling unmarkModified', function(done) {
let BlogPost = db.model(modelName, collection),
b = new BlogPost();
const BlogPost = db.model(modelName, collection);
const b = new BlogPost();
assert.equal(b.isModified('author'), false);
b.author = 'foo';
assert.equal(b.isModified('author'), true);
Expand Down
6 changes: 3 additions & 3 deletions test/model.populate.test.js
Expand Up @@ -7615,17 +7615,17 @@ describe('model: populate:', function() {
const postSchema = new Schema({
name: String
});

postSchema.virtual('comments', {
ref: 'gh6988_Comment',
localField: '_id',
foreignField: 'postId'
});

const commentSchema = new Schema({
postId: { type: Schema.Types.ObjectId }
});

const Post = db.model('gh6988_Post', postSchema);
const Comment = db.model('gh6988_Comment', commentSchema);

Expand Down

0 comments on commit 2d928b4

Please sign in to comment.