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

[misc] run format_fix and lint:fix

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

+ 1 - 1
services/spelling/app.js

@@ -55,7 +55,7 @@ if (!module.parent) {
         return logger.info(`spelling starting up, listening on ${host}:${port}`)
       })
     })
-    .catch((err) => {
+    .catch(err => {
       logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
       process.exit(1)
     })

+ 4 - 4
services/spelling/app/js/ASpell.js

@@ -41,7 +41,7 @@ const cacheDump = setInterval(function () {
       logger.log(OError.tag(err, 'error writing cache file'))
       fs.unlink(cacheFsPathTmp, () => {})
     } else {
-      fs.rename(cacheFsPathTmp, cacheFsPath, (err) => {
+      fs.rename(cacheFsPathTmp, cacheFsPath, err => {
         if (err) {
           logger.error(OError.tag(err, 'error renaming cache file'))
         } else {
@@ -100,7 +100,7 @@ class ASpellRunner {
         {
           hits,
           total: words.length,
-          hitrate: (hits / words.length).toFixed(2)
+          hitrate: (hits / words.length).toFixed(2),
         },
         'cache hit rate'
       )
@@ -176,11 +176,11 @@ const ASpell = {
     const runner = new ASpellRunner()
     return runner.checkWords(language, words, callback)
   },
-  ASPELL_TIMEOUT: 10000
+  ASPELL_TIMEOUT: 10000,
 }
 
 const promises = {
-  checkWords: promisify(ASpell.checkWords)
+  checkWords: promisify(ASpell.checkWords),
 }
 
 ASpell.promises = promises

+ 11 - 11
services/spelling/app/js/ASpellWorker.js

@@ -25,7 +25,7 @@ class ASpellWorker {
       '-t',
       '--encoding=utf-8',
       '-d',
-      language
+      language,
     ])
     logger.info(
       { process: this.pipe.pid, lang: this.language },
@@ -40,7 +40,7 @@ class ASpellWorker {
       )
       metrics.inc('aspellWorker', 1, {
         status: 'exit',
-        method: this.language
+        method: this.language,
       })
     })
     this.pipe.on('close', () => {
@@ -58,14 +58,14 @@ class ASpellWorker {
             stderr: error.slice(-1024),
             workerState: this.state,
             previousWorkerState,
-            closeReason: this.closeReason
+            closeReason: this.closeReason,
           }
         )
         this.callback(err, [])
         this.callback = null
       }
     })
-    this.pipe.on('error', (err) => {
+    this.pipe.on('error', err => {
       const previousWorkerState = this.state
       if (this.state !== 'killed') {
         this.state = 'error'
@@ -77,7 +77,7 @@ class ASpellWorker {
         lang: this.language,
         workerState: this.state,
         previousWorkerState,
-        closeReason: this.closeReason
+        closeReason: this.closeReason,
       })
 
       if (this.callback != null) {
@@ -87,7 +87,7 @@ class ASpellWorker {
         logger.warn(err)
       }
     })
-    this.pipe.stdin.on('error', (err) => {
+    this.pipe.stdin.on('error', err => {
       const previousWorkerState = this.state
       if (this.state !== 'killed') {
         this.state = 'error'
@@ -100,7 +100,7 @@ class ASpellWorker {
         lang: this.language,
         workerState: this.state,
         previousWorkerState,
-        closeReason: this.closeReason
+        closeReason: this.closeReason,
       })
 
       if (this.callback != null) {
@@ -114,7 +114,7 @@ class ASpellWorker {
     this.pipe.stdout.setEncoding('utf8') // ensure utf8 output is handled correctly
     var output = ''
     const endMarkerRegex = new RegExp('^[a-z][a-z]', 'gm')
-    this.pipe.stdout.on('data', (data) => {
+    this.pipe.stdout.on('data', data => {
       // We receive the language code from Aspell as the end of data marker in
       // the data.  The input is a utf8 encoded string.
       const oldPos = output.length
@@ -133,7 +133,7 @@ class ASpellWorker {
               {
                 process: this.pipe.pid,
                 lang: this.language,
-                workerState: this.state
+                workerState: this.state,
               }
             )
           )
@@ -144,7 +144,7 @@ class ASpellWorker {
     })
 
     var error = ''
-    this.pipe.stderr.on('data', (chunk) => {
+    this.pipe.stderr.on('data', chunk => {
       return (error = error + chunk)
     })
 
@@ -168,7 +168,7 @@ class ASpellWorker {
         new OError('Aspell callback already in use - SHOULD NOT HAPPEN', {
           process: this.pipe.pid,
           lang: this.language,
-          workerState: this.state
+          workerState: this.state,
         })
       )
     }

+ 2 - 4
services/spelling/app/js/ASpellWorkerPool.js

@@ -56,9 +56,7 @@ class ASpellWorkerPool {
   }
 
   cleanup() {
-    const active = this.PROCESS_POOL.filter(
-      (worker) => worker.state !== 'killed'
-    )
+    const active = this.PROCESS_POOL.filter(worker => worker.state !== 'killed')
     this.PROCESS_POOL = active
     return metrics.gauge('aspellWorkerPool-size', this.PROCESS_POOL.length)
   }
@@ -68,7 +66,7 @@ class ASpellWorkerPool {
     let worker
     const availableWorker = _.find(
       this.PROCESS_POOL,
-      (cached) => cached.language === language && cached.isReady()
+      cached => cached.language === language && cached.isReady()
     )
     if (availableWorker == null) {
       worker = this.create(language)

+ 3 - 3
services/spelling/app/js/HealthCheckController.js

@@ -9,9 +9,9 @@ module.exports = {
       url: `http://localhost:3005/user/${settings.healthCheckUserId}/check`,
       json: {
         words: ['helllo'],
-        language: 'en'
+        language: 'en',
       },
-      timeout: 1000 * 20
+      timeout: 1000 * 20,
     }
     return request.post(opts, function (err, response, body) {
       if (err != null) {
@@ -35,5 +35,5 @@ module.exports = {
         res.sendStatus(500)
       }
     })
-  }
+  },
 }

+ 25 - 25
services/spelling/app/js/LearnedWordsManager.js

@@ -13,13 +13,13 @@ const LearnedWordsManager = {
     mongoCache.del(userToken)
     return db.spellingPreferences.updateOne(
       {
-        token: userToken
+        token: userToken,
       },
       {
-        $addToSet: { learnedWords: word }
+        $addToSet: { learnedWords: word },
       },
       {
-        upsert: true
+        upsert: true,
       },
       callback
     )
@@ -32,10 +32,10 @@ const LearnedWordsManager = {
     mongoCache.del(userToken)
     return db.spellingPreferences.updateOne(
       {
-        token: userToken
+        token: userToken,
       },
       {
-        $pull: { learnedWords: word }
+        $pull: { learnedWords: word },
       },
       callback
     )
@@ -54,24 +54,24 @@ const LearnedWordsManager = {
     metrics.inc('mongoCache', 0.1, { status: 'miss' })
     logger.info({ userToken }, 'mongoCache miss')
 
-    db.spellingPreferences.findOne({ token: userToken }, function (
-      error,
-      preferences
-    ) {
-      if (error != null) {
-        return callback(OError.tag(error))
+    db.spellingPreferences.findOne(
+      { token: userToken },
+      function (error, preferences) {
+        if (error != null) {
+          return callback(OError.tag(error))
+        }
+        let words =
+          (preferences != null ? preferences.learnedWords : undefined) || []
+        if (words) {
+          // remove duplicates
+          words = words.filter(
+            (value, index, self) => self.indexOf(value) === index
+          )
+        }
+        mongoCache.set(userToken, words)
+        callback(null, words)
       }
-      let words =
-        (preferences != null ? preferences.learnedWords : undefined) || []
-      if (words) {
-        // remove duplicates
-        words = words.filter(
-          (value, index, self) => self.indexOf(value) === index
-        )
-      }
-      mongoCache.set(userToken, words)
-      callback(null, words)
-    })
+    )
   },
 
   deleteUsersLearnedWords(userToken, callback) {
@@ -79,7 +79,7 @@ const LearnedWordsManager = {
       callback = () => {}
     }
     db.spellingPreferences.deleteOne({ token: userToken }, callback)
-  }
+  },
 }
 
 const promises = {
@@ -88,13 +88,13 @@ const promises = {
   getLearnedWords: promisify(LearnedWordsManager.getLearnedWords),
   deleteUsersLearnedWords: promisify(
     LearnedWordsManager.deleteUsersLearnedWords
-  )
+  ),
 }
 
 LearnedWordsManager.promises = promises
 
 module.exports = LearnedWordsManager
-;['learnWord', 'unlearnWord', 'getLearnedWords'].map((method) =>
+;['learnWord', 'unlearnWord', 'getLearnedWords'].map(method =>
   metrics.timeAsyncMethod(
     LearnedWordsManager,
     method,

+ 1 - 1
services/spelling/app/js/MongoCache.js

@@ -3,7 +3,7 @@
 const LRU = require('lru-cache')
 const cacheOpts = {
   max: 15000,
-  maxAge: 1000 * 60 * 60 * 10
+  maxAge: 1000 * 60 * 60 * 10,
 }
 
 const cache = new LRU(cacheOpts)

+ 3 - 3
services/spelling/app/js/SpellingAPIController.js

@@ -26,7 +26,7 @@ module.exports = {
         logger.error(
           OError.tag(error, 'error processing spelling request', {
             user_id: token,
-            wordCount
+            wordCount,
           })
         )
         return res.sendStatus(500)
@@ -74,7 +74,7 @@ module.exports = {
     const token = req.params ? req.params.user_id : undefined
     logger.info(
       {
-        token
+        token,
       },
       'getting user dictionary'
     )
@@ -84,5 +84,5 @@ module.exports = {
       }
       res.send(words)
     })
-  }
+  },
 }

+ 3 - 3
services/spelling/app/js/SpellingAPIManager.js

@@ -52,7 +52,7 @@ const SpellingAPIManager = {
 
   getDic(token, callback) {
     return LearnedWordsManager.getLearnedWords(token, callback)
-  }
+  },
 }
 
 const promises = {
@@ -71,7 +71,7 @@ const promises = {
       const learnedWords = await LearnedWordsManager.promises.getLearnedWords(
         token
       )
-      const notLearntMisspellings = misspellings.filter((m) => {
+      const notLearntMisspellings = misspellings.filter(m => {
         const word = wordSlice[m.index]
         return (
           learnedWords.indexOf(word) === -1 &&
@@ -82,7 +82,7 @@ const promises = {
     } else {
       return { misspellings }
     }
-  }
+  },
 }
 
 SpellingAPIManager.runRequest = callbackify(promises.runRequest)

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

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

+ 7 - 7
services/spelling/config/settings.defaults.js

@@ -4,18 +4,18 @@ module.exports = {
   internal: {
     spelling: {
       port: 3005,
-      host: process.env.LISTEN_ADDRESS || 'localhost'
-    }
+      host: process.env.LISTEN_ADDRESS || 'localhost',
+    },
   },
 
   mongo: {
     options: {
       useUnifiedTopology:
-        (process.env.MONGO_USE_UNIFIED_TOPOLOGY || 'true') === 'true'
+        (process.env.MONGO_USE_UNIFIED_TOPOLOGY || 'true') === 'true',
     },
     url:
       process.env.MONGO_CONNECTION_STRING ||
-      `mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`
+      `mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
   },
 
   cacheDir: Path.resolve('cache'),
@@ -32,10 +32,10 @@ module.exports = {
         'LaTeX',
         'http',
         'https',
-        'www'
+        'www',
       ],
 
   sentry: {
-    dsn: process.env.SENTRY_DSN
-  }
+    dsn: process.env.SENTRY_DSN,
+  },
 }

+ 7 - 7
services/spelling/test/acceptance/js/CheckTest.js

@@ -8,8 +8,8 @@ const checkWord = (words, language) =>
     url: `/user/${USER_ID}/check`,
     body: JSON.stringify({
       words,
-      language
-    })
+      language,
+    }),
   })
 
 describe('checking words', function () {
@@ -27,7 +27,7 @@ describe('checking words', function () {
     it('should return the list of misspellings', async function () {
       const body = JSON.parse(response.body)
       expect(body).to.deep.equal({
-        misspellings: [{ index: 0, suggestions: ['anther', 'another'] }]
+        misspellings: [{ index: 0, suggestions: ['anther', 'another'] }],
       })
     })
   })
@@ -44,7 +44,7 @@ describe('checking words', function () {
 
     it('should have misspelling suggestions with consecutive indexes', async function () {
       const body = JSON.parse(response.body)
-      const indexes = body.misspellings.map((mspl) => mspl.index)
+      const indexes = body.misspellings.map(mspl => mspl.index)
       expect(indexes).to.deep.equal([0, 1, 2])
     })
 
@@ -72,7 +72,7 @@ describe('checking words', function () {
 
     it('should have misspelling suggestions with consecutive indexes', async function () {
       const body = JSON.parse(response.body)
-      const indexList = body.misspellings.map((mspl) => mspl.index)
+      const indexList = body.misspellings.map(mspl => mspl.index)
       expect(indexList.length).to.equal(10000) // avoid testing over an incorrect array
       for (let i = 0; i < indexList.length - 1; i++) {
         expect(indexList[i] + 1).to.equal(indexList[i + 1])
@@ -96,7 +96,7 @@ describe('checking words', function () {
 
     it('should have misspelling suggestions with consecutive indexes', async function () {
       const body = JSON.parse(response.body)
-      const indexList = body.misspellings.map((mspl) => mspl.index)
+      const indexList = body.misspellings.map(mspl => mspl.index)
       expect(indexList.length).to.equal(10000) // avoid testing over an incorrect array
       for (let i = 0; i < indexList.length - 1; i++) {
         expect(indexList[i] + 1).to.equal(indexList[i + 1])
@@ -116,7 +116,7 @@ describe('checking words', function () {
 
     it('should have misspelling suggestions with consecutive indexes', async function () {
       const body = JSON.parse(response.body)
-      const indexes = body.misspellings.map((mspl) => mspl.index)
+      const indexes = body.misspellings.map(mspl => mspl.index)
       expect(indexes).to.deep.equal([0, 1, 2, 3])
     })
 

+ 11 - 11
services/spelling/test/acceptance/js/LearnTest.js

@@ -3,38 +3,38 @@ const request = require('./helpers/request')
 
 const USER_ID = 101
 
-const checkWord = (words) =>
+const checkWord = words =>
   request.post({
     url: `/user/${USER_ID}/check`,
     body: JSON.stringify({
-      words
-    })
+      words,
+    }),
   })
 
-const learnWord = (word) =>
+const learnWord = word =>
   request.post({
     url: `/user/${USER_ID}/learn`,
     body: JSON.stringify({
-      word
-    })
+      word,
+    }),
   })
 
-const unlearnWord = (word) =>
+const unlearnWord = word =>
   request.post({
     url: `/user/${USER_ID}/unlearn`,
     body: JSON.stringify({
-      word
-    })
+      word,
+    }),
   })
 
 const getDict = () =>
   request.get({
-    url: `/user/${USER_ID}`
+    url: `/user/${USER_ID}`,
   })
 
 const deleteDict = () =>
   request.del({
-    url: `/user/${USER_ID}`
+    url: `/user/${USER_ID}`,
   })
 
 describe('learning words', function () {

+ 3 - 3
services/spelling/test/acceptance/js/helpers/request.js

@@ -7,14 +7,14 @@ const BASE_URL = `http://${process.env.HTTP_TEST_HOST || 'localhost'}:${PORT}`
 const request = require('request').defaults({
   baseUrl: BASE_URL,
   headers: {
-    'Content-Type': 'application/json'
+    'Content-Type': 'application/json',
   },
-  followRedirect: false
+  followRedirect: false,
 })
 
 module.exports = {
   PORT,
   get: promisify(request.get),
   post: promisify(request.post),
-  del: promisify(request.del)
+  del: promisify(request.del),
 }

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

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

+ 2 - 2
services/spelling/test/stress/js/stressTest.js

@@ -24,7 +24,7 @@ const wordlist = fs
   .readFileSync(WORDS)
   .toString()
   .split('\n')
-  .filter((w) => w.match(/^[a-z]+$/))
+  .filter(w => w.match(/^[a-z]+$/))
 
 const generateCorrectWords = function (n) {
   const words = []
@@ -154,7 +154,7 @@ q.drain = () => console.log('all items have been processed')
 for (let i = 0; i <= 1000; i++) {
   q.push({
     correct: Math.floor(30 * Math.random()) + 1,
-    incorrect: Math.floor(3 * Math.random())
+    incorrect: Math.floor(3 * Math.random()),
   })
 }
 // if Math.random() < 0.1

+ 4 - 4
services/spelling/test/unit/js/ASpellTests.js

@@ -18,9 +18,9 @@ describe('ASpell', function () {
       requires: {
         '@overleaf/metrics': {
           gauge() {},
-          inc() {}
-        }
-      }
+          inc() {},
+        },
+      },
     }))
   })
   afterEach(function () {
@@ -111,7 +111,7 @@ describe('ASpell', function () {
 
   return describe('when the request times out', function () {
     beforeEach(function (done) {
-      const words = __range__(0, 1000, true).map((i) => 'abcdefg')
+      const words = __range__(0, 1000, true).map(i => 'abcdefg')
       this.ASpell.ASPELL_TIMEOUT = 1
       this.start = Date.now()
       return this.ASpell.checkWords('en', words, (error, result) => {

+ 5 - 5
services/spelling/test/unit/js/ASpellWorkerTests.js

@@ -16,10 +16,10 @@ describe('ASpellWorker', function () {
         requires: {
           '@overleaf/metrics': {
             gauge() {},
-            inc() {}
+            inc() {},
           },
-          child_process: this.child_process
-        }
+          child_process: this.child_process,
+        },
       }
     ))
   })
@@ -31,7 +31,7 @@ describe('ASpellWorker', function () {
         stderr: { on: sinon.stub() },
         stdin: { on: sinon.stub() },
         on: sinon.stub(),
-        pid: 12345
+        pid: 12345,
       }
       this.child_process.spawn = sinon.stub().returns(this.pipe)
       this.pipe.stdout.setEncoding = sinon.stub()
@@ -92,7 +92,7 @@ describe('ASpellWorker', function () {
     describe('with everything split across chunks', function () {
       beforeEach(function () {
         this.callback = worker.callback = sinon.stub()
-        '& hello\n& world\nen\n& goodbye'.split('').forEach((x) => {
+        '& hello\n& world\nen\n& goodbye'.split('').forEach(x => {
           this.pipe.stdout.emit('data', x)
         })
       })

+ 11 - 11
services/spelling/test/unit/js/LearnedWordsManagerTests.js

@@ -12,13 +12,13 @@ describe('LearnedWordsManager', function () {
     this.callback = sinon.stub()
     this.db = {
       spellingPreferences: {
-        updateOne: sinon.stub().yields()
-      }
+        updateOne: sinon.stub().yields(),
+      },
     }
     this.cache = {
       get: sinon.stub(),
       set: sinon.stub(),
-      del: sinon.stub()
+      del: sinon.stub(),
     }
     this.LearnedWordsManager = SandboxedModule.require(modulePath, {
       requires: {
@@ -26,9 +26,9 @@ describe('LearnedWordsManager', function () {
         './MongoCache': this.cache,
         '@overleaf/metrics': {
           timeAsyncMethod: sinon.stub(),
-          inc: sinon.stub()
-        }
-      }
+          inc: sinon.stub(),
+        },
+      },
     })
   })
 
@@ -42,13 +42,13 @@ describe('LearnedWordsManager', function () {
       expect(
         this.db.spellingPreferences.updateOne.calledWith(
           {
-            token: this.token
+            token: this.token,
           },
           {
-            $addToSet: { learnedWords: this.word }
+            $addToSet: { learnedWords: this.word },
           },
           {
-            upsert: true
+            upsert: true,
           }
         )
       ).to.equal(true)
@@ -69,10 +69,10 @@ describe('LearnedWordsManager', function () {
       expect(
         this.db.spellingPreferences.updateOne.calledWith(
           {
-            token: this.token
+            token: this.token,
           },
           {
-            $pull: { learnedWords: this.word }
+            $pull: { learnedWords: this.word },
           }
         )
       ).to.equal(true)

+ 18 - 22
services/spelling/test/unit/js/SpellingAPIManagerTests.js

@@ -9,7 +9,7 @@ const modulePath = require('path').join(
   '../../../app/js/SpellingAPIManager'
 )
 
-const promiseStub = (val) => new Promise((resolve) => resolve(val))
+const promiseStub = val => new Promise(resolve => resolve(val))
 
 describe('SpellingAPIManager', function () {
   beforeEach(function () {
@@ -21,16 +21,16 @@ describe('SpellingAPIManager', function () {
       learnWord: sinon.stub().callsArg(2),
       unlearnWord: sinon.stub().callsArg(2),
       promises: {
-        getLearnedWords: sinon.stub().returns(promiseStub(this.learnedWords))
-      }
+        getLearnedWords: sinon.stub().returns(promiseStub(this.learnedWords)),
+      },
     }
 
     this.SpellingAPIManager = SandboxedModule.require(modulePath, {
       requires: {
         './ASpell': this.ASpell,
         '@overleaf/settings': { ignoredMisspellings: ['ShareLaTeX'] },
-        './LearnedWordsManager': this.LearnedWordsManager
-      }
+        './LearnedWordsManager': this.LearnedWordsManager,
+      },
     })
   })
 
@@ -43,14 +43,14 @@ describe('SpellingAPIManager', function () {
         'are',
         'speled',
         'rong',
-        'lerned'
+        'lerned',
       ]
       this.allWords = this.nonLearnedWords.concat(this.learnedWords)
       this.misspellings = [
         { index: 2, suggestions: ['that'] },
         { index: 4, suggestions: ['spelled'] },
         { index: 5, suggestions: ['wrong', 'ring'] },
-        { index: 6, suggestions: ['learned'] }
+        { index: 6, suggestions: ['learned'] },
       ]
       this.misspellingsWithoutLearnedWords = this.misspellings.slice(0, 3)
 
@@ -58,7 +58,7 @@ describe('SpellingAPIManager', function () {
         callback(null, this.misspellings)
       }
       this.ASpell.promises = {
-        checkWords: sinon.stub().returns(promiseStub(this.misspellings))
+        checkWords: sinon.stub().returns(promiseStub(this.misspellings)),
       }
       sinon.spy(this.ASpell, 'checkWords')
     })
@@ -140,7 +140,7 @@ describe('SpellingAPIManager', function () {
           this.token,
           {
             words: this.allWords,
-            language: this.language
+            language: this.language,
           },
           (error, result) => {
             this.result = result
@@ -181,7 +181,7 @@ describe('SpellingAPIManager', function () {
   describe('learnWord', function () {
     describe('without a token', function () {
       beforeEach(function (done) {
-        this.SpellingAPIManager.learnWord(null, { word: 'banana' }, (error) => {
+        this.SpellingAPIManager.learnWord(null, { word: 'banana' }, error => {
           this.error = error
           done()
         })
@@ -196,7 +196,7 @@ describe('SpellingAPIManager', function () {
 
     describe('without a word', function () {
       beforeEach(function (done) {
-        this.SpellingAPIManager.learnWord(this.token, {}, (error) => {
+        this.SpellingAPIManager.learnWord(this.token, {}, error => {
           this.error = error
           done()
         })
@@ -215,7 +215,7 @@ describe('SpellingAPIManager', function () {
         this.SpellingAPIManager.learnWord(
           this.token,
           { word: this.word },
-          (error) => {
+          error => {
             this.error = error
             done()
           }
@@ -233,14 +233,10 @@ describe('SpellingAPIManager', function () {
   describe('unlearnWord', function () {
     describe('without a token', function () {
       beforeEach(function (done) {
-        this.SpellingAPIManager.unlearnWord(
-          null,
-          { word: 'banana' },
-          (error) => {
-            this.error = error
-            done()
-          }
-        )
+        this.SpellingAPIManager.unlearnWord(null, { word: 'banana' }, error => {
+          this.error = error
+          done()
+        })
       })
 
       it('should return an error', function () {
@@ -252,7 +248,7 @@ describe('SpellingAPIManager', function () {
 
     describe('without a word', function () {
       beforeEach(function (done) {
-        this.SpellingAPIManager.unlearnWord(this.token, {}, (error) => {
+        this.SpellingAPIManager.unlearnWord(this.token, {}, error => {
           this.error = error
           done()
         })
@@ -271,7 +267,7 @@ describe('SpellingAPIManager', function () {
         this.SpellingAPIManager.unlearnWord(
           this.token,
           { word: this.word },
-          (error) => {
+          error => {
             this.error = error
             done()
           }