Просмотр исходного кода

[misc] run format_fix and lint:fix

Jakob Ackermann 5 лет назад
Родитель
Сommit
9a2bb1044f

+ 3 - 3
services/notifications/app.js

@@ -56,12 +56,12 @@ app.get('*', (req, res) => res.sendStatus(404))
 const host =
 const host =
   __guard__(
   __guard__(
     Settings.internal != null ? Settings.internal.notifications : undefined,
     Settings.internal != null ? Settings.internal.notifications : undefined,
-    (x) => x.host
+    x => x.host
   ) || 'localhost'
   ) || 'localhost'
 const port =
 const port =
   __guard__(
   __guard__(
     Settings.internal != null ? Settings.internal.notifications : undefined,
     Settings.internal != null ? Settings.internal.notifications : undefined,
-    (x1) => x1.port
+    x1 => x1.port
   ) || 3042
   ) || 3042
 
 
 mongodb
 mongodb
@@ -71,7 +71,7 @@ mongodb
       logger.info(`notifications starting up, listening on ${host}:${port}`)
       logger.info(`notifications starting up, listening on ${host}:${port}`)
     )
     )
   })
   })
-  .catch((err) => {
+  .catch(err => {
     logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
     logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
     process.exit(1)
     process.exit(1)
   })
   })

+ 7 - 7
services/notifications/app/js/HealthCheckController.js

@@ -22,13 +22,13 @@ const logger = require('logger-sharelatex')
 module.exports = {
 module.exports = {
   check(callback) {
   check(callback) {
     const user_id = ObjectId()
     const user_id = ObjectId()
-    const cleanupNotifications = (callback) =>
+    const cleanupNotifications = callback =>
       db.notifications.remove({ user_id }, callback)
       db.notifications.remove({ user_id }, callback)
 
 
     let notification_key = `smoke-test-notification-${ObjectId()}`
     let notification_key = `smoke-test-notification-${ObjectId()}`
-    const getOpts = (endPath) => ({
+    const getOpts = endPath => ({
       url: `http://localhost:${port}/user/${user_id}${endPath}`,
       url: `http://localhost:${port}/user/${user_id}${endPath}`,
-      timeout: 5000
+      timeout: 5000,
     })
     })
     logger.log(
     logger.log(
       { user_id, opts: getOpts(), key: notification_key, user_id },
       { user_id, opts: getOpts(), key: notification_key, user_id },
@@ -41,7 +41,7 @@ module.exports = {
           key: notification_key,
           key: notification_key,
           messageOpts: '',
           messageOpts: '',
           templateKey: 'f4g5',
           templateKey: 'f4g5',
-          user_id
+          user_id,
         }
         }
         return request.post(opts, cb)
         return request.post(opts, cb)
       },
       },
@@ -59,7 +59,7 @@ module.exports = {
           }
           }
           const hasNotification = _.some(
           const hasNotification = _.some(
             body,
             body,
-            (notification) =>
+            notification =>
               notification.key === notification_key &&
               notification.key === notification_key &&
               notification.user_id === user_id.toString()
               notification.user_id === user_id.toString()
           )
           )
@@ -73,7 +73,7 @@ module.exports = {
             return cb('notification not found in response')
             return cb('notification not found in response')
           }
           }
         })
         })
-      }
+      },
     ]
     ]
     return async.series(jobs, function (err, body) {
     return async.series(jobs, function (err, body) {
       if (err != null) {
       if (err != null) {
@@ -112,5 +112,5 @@ module.exports = {
         })
         })
       }
       }
     })
     })
-  }
+  },
 }
 }

+ 44 - 43
services/notifications/app/js/Notifications.js

@@ -23,7 +23,7 @@ module.exports = Notifications = {
     }
     }
     const query = {
     const query = {
       user_id: ObjectId(user_id),
       user_id: ObjectId(user_id),
-      templateKey: { $exists: true }
+      templateKey: { $exists: true },
     }
     }
     db.notifications.find(query).toArray(callback)
     db.notifications.find(query).toArray(callback)
   },
   },
@@ -34,7 +34,7 @@ module.exports = Notifications = {
     }
     }
     const query = {
     const query = {
       user_id: ObjectId(user_id),
       user_id: ObjectId(user_id),
-      key: notification.key
+      key: notification.key,
     }
     }
     return db.notifications.count(query, function (err, count) {
     return db.notifications.count(query, function (err, count) {
       if (err != null) {
       if (err != null) {
@@ -45,52 +45,53 @@ module.exports = Notifications = {
   },
   },
 
 
   addNotification(user_id, notification, callback) {
   addNotification(user_id, notification, callback) {
-    return this._countExistingNotifications(user_id, notification, function (
-      err,
-      count
-    ) {
-      if (err != null) {
-        return callback(err)
-      }
-      if (count !== 0 && !notification.forceCreate) {
-        return callback()
-      }
-      const doc = {
-        user_id: ObjectId(user_id),
-        key: notification.key,
-        messageOpts: notification.messageOpts,
-        templateKey: notification.templateKey
-      }
-      // TTL index on the optional `expires` field, which should arrive as an iso date-string, corresponding to
-      // a datetime in the future when the document should be automatically removed.
-      // in Mongo, TTL indexes only work on date fields, and ignore the document when that field is missing
-      // see `README.md` for instruction on creating TTL index
-      if (notification.expires != null) {
-        try {
-          doc.expires = new Date(notification.expires)
-          const _testValue = doc.expires.toISOString()
-        } catch (error) {
-          err = error
-          logger.error(
-            { user_id, expires: notification.expires },
-            'error converting `expires` field to Date'
-          )
+    return this._countExistingNotifications(
+      user_id,
+      notification,
+      function (err, count) {
+        if (err != null) {
           return callback(err)
           return callback(err)
         }
         }
+        if (count !== 0 && !notification.forceCreate) {
+          return callback()
+        }
+        const doc = {
+          user_id: ObjectId(user_id),
+          key: notification.key,
+          messageOpts: notification.messageOpts,
+          templateKey: notification.templateKey,
+        }
+        // TTL index on the optional `expires` field, which should arrive as an iso date-string, corresponding to
+        // a datetime in the future when the document should be automatically removed.
+        // in Mongo, TTL indexes only work on date fields, and ignore the document when that field is missing
+        // see `README.md` for instruction on creating TTL index
+        if (notification.expires != null) {
+          try {
+            doc.expires = new Date(notification.expires)
+            const _testValue = doc.expires.toISOString()
+          } catch (error) {
+            err = error
+            logger.error(
+              { user_id, expires: notification.expires },
+              'error converting `expires` field to Date'
+            )
+            return callback(err)
+          }
+        }
+        db.notifications.updateOne(
+          { user_id: doc.user_id, key: notification.key },
+          { $set: doc },
+          { upsert: true },
+          callback
+        )
       }
       }
-      db.notifications.updateOne(
-        { user_id: doc.user_id, key: notification.key },
-        { $set: doc },
-        { upsert: true },
-        callback
-      )
-    })
+    )
   },
   },
 
 
   removeNotificationId(user_id, notification_id, callback) {
   removeNotificationId(user_id, notification_id, callback) {
     const searchOps = {
     const searchOps = {
       user_id: ObjectId(user_id),
       user_id: ObjectId(user_id),
-      _id: ObjectId(notification_id)
+      _id: ObjectId(notification_id),
     }
     }
     const updateOperation = { $unset: { templateKey: true, messageOpts: true } }
     const updateOperation = { $unset: { templateKey: true, messageOpts: true } }
     db.notifications.updateOne(searchOps, updateOperation, callback)
     db.notifications.updateOne(searchOps, updateOperation, callback)
@@ -99,7 +100,7 @@ module.exports = Notifications = {
   removeNotificationKey(user_id, notification_key, callback) {
   removeNotificationKey(user_id, notification_key, callback) {
     const searchOps = {
     const searchOps = {
       user_id: ObjectId(user_id),
       user_id: ObjectId(user_id),
-      key: notification_key
+      key: notification_key,
     }
     }
     const updateOperation = { $unset: { templateKey: true } }
     const updateOperation = { $unset: { templateKey: true } }
     db.notifications.updateOne(searchOps, updateOperation, callback)
     db.notifications.updateOne(searchOps, updateOperation, callback)
@@ -115,8 +116,8 @@ module.exports = Notifications = {
   deleteNotificationByKeyOnly(notification_key, callback) {
   deleteNotificationByKeyOnly(notification_key, callback) {
     const searchOps = { key: notification_key }
     const searchOps = { key: notification_key }
     db.notifications.deleteOne(searchOps, callback)
     db.notifications.deleteOne(searchOps, callback)
-  }
+  },
 }
 }
-;['getUserNotifications', 'addNotification'].map((method) =>
+;['getUserNotifications', 'addNotification'].map(method =>
   metrics.timeAsyncMethod(Notifications, method, 'mongo.Notifications', logger)
   metrics.timeAsyncMethod(Notifications, method, 'mongo.Notifications', logger)
 )
 )

+ 2 - 2
services/notifications/app/js/NotificationsController.js

@@ -50,7 +50,7 @@ module.exports = {
     logger.log(
     logger.log(
       {
       {
         user_id: req.params.user_id,
         user_id: req.params.user_id,
-        notification_id: req.params.notification_id
+        notification_id: req.params.notification_id,
       },
       },
       'mark id notification as read'
       'mark id notification as read'
     )
     )
@@ -83,5 +83,5 @@ module.exports = {
       notification_key,
       notification_key,
       (err, notifications) => res.sendStatus(200)
       (err, notifications) => res.sendStatus(200)
     )
     )
-  }
+  },
 }
 }

+ 1 - 1
services/notifications/app/js/mongodb.js

@@ -24,5 +24,5 @@ async function setupDb() {
 module.exports = {
 module.exports = {
   db,
   db,
   ObjectId,
   ObjectId,
-  waitForDb
+  waitForDb,
 }
 }

+ 5 - 5
services/notifications/config/settings.defaults.js

@@ -2,17 +2,17 @@ module.exports = {
   internal: {
   internal: {
     notifications: {
     notifications: {
       port: 3042,
       port: 3042,
-      host: process.env.LISTEN_ADDRESS || 'localhost'
-    }
+      host: process.env.LISTEN_ADDRESS || 'localhost',
+    },
   },
   },
 
 
   mongo: {
   mongo: {
     options: {
     options: {
       useUnifiedTopology:
       useUnifiedTopology:
-        (process.env.MONGO_USE_UNIFIED_TOPOLOGY || 'true') === 'true'
+        (process.env.MONGO_USE_UNIFIED_TOPOLOGY || 'true') === 'true',
     },
     },
     url:
     url:
       process.env.MONGO_CONNECTION_STRING ||
       process.env.MONGO_CONNECTION_STRING ||
-      `mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`
-  }
+      `mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
+  },
 }
 }

+ 3 - 3
services/notifications/test/setup.js

@@ -14,8 +14,8 @@ SandboxedModule.configure({
       warn() {},
       warn() {},
       err() {},
       err() {},
       error() {},
       error() {},
-      fatal() {}
-    }
+      fatal() {},
+    },
   },
   },
-  globals: { Buffer, JSON, console, process }
+  globals: { Buffer, JSON, console, process },
 })
 })

+ 25 - 25
services/notifications/test/unit/js/NotificationsControllerTest.js

@@ -27,17 +27,17 @@ describe('Notifications Controller', function () {
       requires: {
       requires: {
         './Notifications': this.notifications,
         './Notifications': this.notifications,
         '@overleaf/metrics': {
         '@overleaf/metrics': {
-          inc: sinon.stub()
-        }
-      }
+          inc: sinon.stub(),
+        },
+      },
     })
     })
 
 
     return (this.stubbedNotification = [
     return (this.stubbedNotification = [
       {
       {
         key: notification_key,
         key: notification_key,
         messageOpts: 'some info',
         messageOpts: 'some info',
-        templateKey: 'template-key'
-      }
+        templateKey: 'template-key',
+      },
     ])
     ])
   })
   })
 
 
@@ -48,17 +48,17 @@ describe('Notifications Controller', function () {
         .callsArgWith(1, null, this.stubbedNotification)
         .callsArgWith(1, null, this.stubbedNotification)
       const req = {
       const req = {
         params: {
         params: {
-          user_id
-        }
+          user_id,
+        },
       }
       }
       return this.controller.getUserNotifications(req, {
       return this.controller.getUserNotifications(req, {
-        json: (result) => {
+        json: result => {
           result.should.equal(this.stubbedNotification)
           result.should.equal(this.stubbedNotification)
           this.notifications.getUserNotifications
           this.notifications.getUserNotifications
             .calledWith(user_id)
             .calledWith(user_id)
             .should.equal(true)
             .should.equal(true)
           return done()
           return done()
-        }
+        },
       })
       })
     })
     })
   })
   })
@@ -68,18 +68,18 @@ describe('Notifications Controller', function () {
       this.notifications.addNotification = sinon.stub().callsArgWith(2)
       this.notifications.addNotification = sinon.stub().callsArgWith(2)
       const req = {
       const req = {
         params: {
         params: {
-          user_id
+          user_id,
         },
         },
-        body: this.stubbedNotification
+        body: this.stubbedNotification,
       }
       }
       return this.controller.addNotification(req, {
       return this.controller.addNotification(req, {
-        sendStatus: (code) => {
+        sendStatus: code => {
           this.notifications.addNotification
           this.notifications.addNotification
             .calledWith(user_id, this.stubbedNotification)
             .calledWith(user_id, this.stubbedNotification)
             .should.equal(true)
             .should.equal(true)
           code.should.equal(200)
           code.should.equal(200)
           return done()
           return done()
-        }
+        },
       })
       })
     })
     })
   })
   })
@@ -90,17 +90,17 @@ describe('Notifications Controller', function () {
       const req = {
       const req = {
         params: {
         params: {
           user_id,
           user_id,
-          notification_id
-        }
+          notification_id,
+        },
       }
       }
       return this.controller.removeNotificationId(req, {
       return this.controller.removeNotificationId(req, {
-        sendStatus: (code) => {
+        sendStatus: code => {
           this.notifications.removeNotificationId
           this.notifications.removeNotificationId
             .calledWith(user_id, notification_id)
             .calledWith(user_id, notification_id)
             .should.equal(true)
             .should.equal(true)
           code.should.equal(200)
           code.should.equal(200)
           return done()
           return done()
-        }
+        },
       })
       })
     })
     })
   })
   })
@@ -110,18 +110,18 @@ describe('Notifications Controller', function () {
       this.notifications.removeNotificationKey = sinon.stub().callsArgWith(2)
       this.notifications.removeNotificationKey = sinon.stub().callsArgWith(2)
       const req = {
       const req = {
         params: {
         params: {
-          user_id
+          user_id,
         },
         },
-        body: { key: notification_key }
+        body: { key: notification_key },
       }
       }
       return this.controller.removeNotificationKey(req, {
       return this.controller.removeNotificationKey(req, {
-        sendStatus: (code) => {
+        sendStatus: code => {
           this.notifications.removeNotificationKey
           this.notifications.removeNotificationKey
             .calledWith(user_id, notification_key)
             .calledWith(user_id, notification_key)
             .should.equal(true)
             .should.equal(true)
           code.should.equal(200)
           code.should.equal(200)
           return done()
           return done()
-        }
+        },
       })
       })
     })
     })
   })
   })
@@ -133,17 +133,17 @@ describe('Notifications Controller', function () {
         .callsArgWith(1)
         .callsArgWith(1)
       const req = {
       const req = {
         params: {
         params: {
-          key: notification_key
-        }
+          key: notification_key,
+        },
       }
       }
       return this.controller.removeNotificationByKeyOnly(req, {
       return this.controller.removeNotificationByKeyOnly(req, {
-        sendStatus: (code) => {
+        sendStatus: code => {
           this.notifications.removeNotificationByKeyOnly
           this.notifications.removeNotificationByKeyOnly
             .calledWith(notification_key)
             .calledWith(notification_key)
             .should.equal(true)
             .should.equal(true)
           code.should.equal(200)
           code.should.equal(200)
           return done()
           return done()
-        }
+        },
       })
       })
     })
     })
   })
   })

+ 27 - 27
services/notifications/test/unit/js/NotificationsTests.js

@@ -35,23 +35,23 @@ describe('Notifications Tests', function () {
         find: this.findStub,
         find: this.findStub,
         count: this.countStub,
         count: this.countStub,
         updateOne: this.updateOneStub,
         updateOne: this.updateOneStub,
-        deleteOne: this.deleteOneStub
-      }
+        deleteOne: this.deleteOneStub,
+      },
     }
     }
 
 
     this.notifications = SandboxedModule.require(modulePath, {
     this.notifications = SandboxedModule.require(modulePath, {
       requires: {
       requires: {
         '@overleaf/settings': {},
         '@overleaf/settings': {},
         './mongodb': { db: this.db, ObjectId },
         './mongodb': { db: this.db, ObjectId },
-        '@overleaf/metrics': { timeAsyncMethod: sinon.stub() }
-      }
+        '@overleaf/metrics': { timeAsyncMethod: sinon.stub() },
+      },
     })
     })
 
 
     this.stubbedNotification = {
     this.stubbedNotification = {
       user_id: ObjectId(user_id),
       user_id: ObjectId(user_id),
       key: 'notification-key',
       key: 'notification-key',
       messageOpts: 'some info',
       messageOpts: 'some info',
-      templateKey: 'template-key'
+      templateKey: 'template-key',
     }
     }
     return (this.stubbedNotificationArray = [this.stubbedNotification])
     return (this.stubbedNotificationArray = [this.stubbedNotification])
   })
   })
@@ -65,7 +65,7 @@ describe('Notifications Tests', function () {
           notifications.should.equal(this.stubbedNotificationArray)
           notifications.should.equal(this.stubbedNotificationArray)
           assert.deepEqual(this.findStub.args[0][0], {
           assert.deepEqual(this.findStub.args[0][0], {
             user_id: ObjectId(user_id),
             user_id: ObjectId(user_id),
-            templateKey: { $exists: true }
+            templateKey: { $exists: true },
           })
           })
           return done()
           return done()
         }
         }
@@ -79,17 +79,17 @@ describe('Notifications Tests', function () {
         user_id: ObjectId(user_id),
         user_id: ObjectId(user_id),
         key: 'notification-key',
         key: 'notification-key',
         messageOpts: 'some info',
         messageOpts: 'some info',
-        templateKey: 'template-key'
+        templateKey: 'template-key',
       }
       }
       this.expectedDocument = {
       this.expectedDocument = {
         user_id: this.stubbedNotification.user_id,
         user_id: this.stubbedNotification.user_id,
         key: 'notification-key',
         key: 'notification-key',
         messageOpts: 'some info',
         messageOpts: 'some info',
-        templateKey: 'template-key'
+        templateKey: 'template-key',
       }
       }
       this.expectedQuery = {
       this.expectedQuery = {
         user_id: this.stubbedNotification.user_id,
         user_id: this.stubbedNotification.user_id,
-        key: 'notification-key'
+        key: 'notification-key',
       }
       }
       this.updateOneStub.yields()
       this.updateOneStub.yields()
       return this.countStub.yields(null, 0)
       return this.countStub.yields(null, 0)
@@ -99,7 +99,7 @@ describe('Notifications Tests', function () {
       return this.notifications.addNotification(
       return this.notifications.addNotification(
         user_id,
         user_id,
         this.stubbedNotification,
         this.stubbedNotification,
-        (err) => {
+        err => {
           expect(err).not.to.exist
           expect(err).not.to.exist
           sinon.assert.calledWith(
           sinon.assert.calledWith(
             this.updateOneStub,
             this.updateOneStub,
@@ -121,7 +121,7 @@ describe('Notifications Tests', function () {
         return this.notifications.addNotification(
         return this.notifications.addNotification(
           user_id,
           user_id,
           this.stubbedNotification,
           this.stubbedNotification,
-          (err) => {
+          err => {
             expect(err).not.to.exist
             expect(err).not.to.exist
             sinon.assert.notCalled(this.updateOneStub)
             sinon.assert.notCalled(this.updateOneStub)
             return done()
             return done()
@@ -134,7 +134,7 @@ describe('Notifications Tests', function () {
         return this.notifications.addNotification(
         return this.notifications.addNotification(
           user_id,
           user_id,
           this.stubbedNotification,
           this.stubbedNotification,
-          (err) => {
+          err => {
             expect(err).not.to.exist
             expect(err).not.to.exist
             sinon.assert.calledWith(
             sinon.assert.calledWith(
               this.updateOneStub,
               this.updateOneStub,
@@ -155,18 +155,18 @@ describe('Notifications Tests', function () {
           key: 'notification-key',
           key: 'notification-key',
           messageOpts: 'some info',
           messageOpts: 'some info',
           templateKey: 'template-key',
           templateKey: 'template-key',
-          expires: '2922-02-13T09:32:56.289Z'
+          expires: '2922-02-13T09:32:56.289Z',
         }
         }
         this.expectedDocument = {
         this.expectedDocument = {
           user_id: this.stubbedNotification.user_id,
           user_id: this.stubbedNotification.user_id,
           key: 'notification-key',
           key: 'notification-key',
           messageOpts: 'some info',
           messageOpts: 'some info',
           templateKey: 'template-key',
           templateKey: 'template-key',
-          expires: new Date(this.stubbedNotification.expires)
+          expires: new Date(this.stubbedNotification.expires),
         }
         }
         return (this.expectedQuery = {
         return (this.expectedQuery = {
           user_id: this.stubbedNotification.user_id,
           user_id: this.stubbedNotification.user_id,
-          key: 'notification-key'
+          key: 'notification-key',
         })
         })
       })
       })
 
 
@@ -174,7 +174,7 @@ describe('Notifications Tests', function () {
         return this.notifications.addNotification(
         return this.notifications.addNotification(
           user_id,
           user_id,
           this.stubbedNotification,
           this.stubbedNotification,
-          (err) => {
+          err => {
             expect(err).not.to.exist
             expect(err).not.to.exist
             sinon.assert.calledWith(
             sinon.assert.calledWith(
               this.updateOneStub,
               this.updateOneStub,
@@ -195,14 +195,14 @@ describe('Notifications Tests', function () {
           key: 'notification-key',
           key: 'notification-key',
           messageOpts: 'some info',
           messageOpts: 'some info',
           templateKey: 'template-key',
           templateKey: 'template-key',
-          expires: 'WAT'
+          expires: 'WAT',
         }
         }
         return (this.expectedDocument = {
         return (this.expectedDocument = {
           user_id: this.stubbedNotification.user_id,
           user_id: this.stubbedNotification.user_id,
           key: 'notification-key',
           key: 'notification-key',
           messageOpts: 'some info',
           messageOpts: 'some info',
           templateKey: 'template-key',
           templateKey: 'template-key',
-          expires: new Date(this.stubbedNotification.expires)
+          expires: new Date(this.stubbedNotification.expires),
         })
         })
       })
       })
 
 
@@ -210,7 +210,7 @@ describe('Notifications Tests', function () {
         return this.notifications.addNotification(
         return this.notifications.addNotification(
           user_id,
           user_id,
           this.stubbedNotification,
           this.stubbedNotification,
-          (err) => {
+          err => {
             ;(err instanceof Error).should.equal(true)
             ;(err instanceof Error).should.equal(true)
             sinon.assert.notCalled(this.updateOneStub)
             sinon.assert.notCalled(this.updateOneStub)
             return done()
             return done()
@@ -227,13 +227,13 @@ describe('Notifications Tests', function () {
       return this.notifications.removeNotificationId(
       return this.notifications.removeNotificationId(
         user_id,
         user_id,
         notification_id,
         notification_id,
-        (err) => {
+        err => {
           const searchOps = {
           const searchOps = {
             user_id: ObjectId(user_id),
             user_id: ObjectId(user_id),
-            _id: ObjectId(notification_id)
+            _id: ObjectId(notification_id),
           }
           }
           const updateOperation = {
           const updateOperation = {
-            $unset: { templateKey: true, messageOpts: true }
+            $unset: { templateKey: true, messageOpts: true },
           }
           }
           assert.deepEqual(this.updateOneStub.args[0][0], searchOps)
           assert.deepEqual(this.updateOneStub.args[0][0], searchOps)
           assert.deepEqual(this.updateOneStub.args[0][1], updateOperation)
           assert.deepEqual(this.updateOneStub.args[0][1], updateOperation)
@@ -250,13 +250,13 @@ describe('Notifications Tests', function () {
       return this.notifications.removeNotificationKey(
       return this.notifications.removeNotificationKey(
         user_id,
         user_id,
         notification_key,
         notification_key,
-        (err) => {
+        err => {
           const searchOps = {
           const searchOps = {
             user_id: ObjectId(user_id),
             user_id: ObjectId(user_id),
-            key: notification_key
+            key: notification_key,
           }
           }
           const updateOperation = {
           const updateOperation = {
-            $unset: { templateKey: true }
+            $unset: { templateKey: true },
           }
           }
           assert.deepEqual(this.updateOneStub.args[0][0], searchOps)
           assert.deepEqual(this.updateOneStub.args[0][0], searchOps)
           assert.deepEqual(this.updateOneStub.args[0][1], updateOperation)
           assert.deepEqual(this.updateOneStub.args[0][1], updateOperation)
@@ -272,7 +272,7 @@ describe('Notifications Tests', function () {
 
 
       return this.notifications.removeNotificationByKeyOnly(
       return this.notifications.removeNotificationByKeyOnly(
         notification_key,
         notification_key,
-        (err) => {
+        err => {
           const searchOps = { key: notification_key }
           const searchOps = { key: notification_key }
           const updateOperation = { $unset: { templateKey: true } }
           const updateOperation = { $unset: { templateKey: true } }
           assert.deepEqual(this.updateOneStub.args[0][0], searchOps)
           assert.deepEqual(this.updateOneStub.args[0][0], searchOps)
@@ -289,7 +289,7 @@ describe('Notifications Tests', function () {
 
 
       return this.notifications.deleteNotificationByKeyOnly(
       return this.notifications.deleteNotificationByKeyOnly(
         notification_key,
         notification_key,
-        (err) => {
+        err => {
           const searchOps = { key: notification_key }
           const searchOps = { key: notification_key }
           assert.deepEqual(this.deleteOneStub.args[0][0], searchOps)
           assert.deepEqual(this.deleteOneStub.args[0][0], searchOps)
           return done()
           return done()