From 21850f1e6f7d13276211193dc4394ba629c9a6cc Mon Sep 17 00:00:00 2001 From: decaffeinate Date: Wed, 6 May 2020 12:11:22 +0200 Subject: [PATCH] decaffeinate: Run post-processing cleanups on DiffCodecTests.coffee and 23 other files --- .../unit/coffee/DiffCodec/DiffCodecTests.js | 15 ++++-- .../DispatchManager/DispatchManagerTests.js | 13 +++-- .../DocumentManager/DocumentManagerTests.js | 16 ++++-- .../HistoryManager/HistoryManagerTests.js | 6 +++ .../HistoryRedisManagerTests.js | 7 +++ .../HttpController/HttpControllerTests.js | 6 +++ .../coffee/LockManager/CheckingTheLock.js | 11 +++- .../coffee/LockManager/ReleasingTheLock.js | 7 +++ .../unit/coffee/LockManager/getLockTests.js | 8 +++ .../unit/coffee/LockManager/tryLockTests.js | 7 +++ .../PersistenceManagerTests.js | 6 +++ .../ProjectHistoryRedisManagerTests.js | 13 +++-- .../flushAndDeleteProjectTests.js | 7 +++ .../ProjectManager/flushProjectTests.js | 8 +++ .../ProjectManager/getProjectDocsTests.js | 6 +++ .../ProjectManager/updateProjectTests.js | 6 +++ .../RangesManager/RangesManagerTests.js | 8 +++ .../RateLimitManager/RateLimitManager.js | 6 +++ .../RealTimeRedisManagerTests.js | 7 +++ .../coffee/RedisManager/RedisManagerTests.js | 11 +++- .../unit/coffee/ShareJS/TextTransformTests.js | 51 +++++++++++-------- .../unit/coffee/ShareJsDB/ShareJsDBTests.js | 10 +++- .../ShareJsUpdateManagerTests.js | 6 +++ .../UpdateManager/UpdateManagerTests.js | 10 +++- 24 files changed, 207 insertions(+), 44 deletions(-) diff --git a/services/document-updater/test/unit/coffee/DiffCodec/DiffCodecTests.js b/services/document-updater/test/unit/coffee/DiffCodec/DiffCodecTests.js index f3e6f5bbee..85bb8c6a1b 100644 --- a/services/document-updater/test/unit/coffee/DiffCodec/DiffCodecTests.js +++ b/services/document-updater/test/unit/coffee/DiffCodec/DiffCodecTests.js @@ -1,3 +1,10 @@ +/* eslint-disable + handle-callback-err, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns @@ -22,7 +29,7 @@ describe("DiffCodec", function() { it("should insert new text correctly", function(done) { this.before = ["hello world"]; this.after = ["hello beautiful world"]; - return this.DiffCodec.diffAsShareJsOp(this.before, this.after, function(error, ops) { + return this.DiffCodec.diffAsShareJsOp(this.before, this.after, (error, ops) => { expect(ops).to.deep.equal([{ i: "beautiful ", p: 6 @@ -35,7 +42,7 @@ describe("DiffCodec", function() { it("should shift later inserts by previous inserts", function(done) { this.before = ["the boy played with the ball"]; this.after = ["the tall boy played with the red ball"]; - return this.DiffCodec.diffAsShareJsOp(this.before, this.after, function(error, ops) { + return this.DiffCodec.diffAsShareJsOp(this.before, this.after, (error, ops) => { expect(ops).to.deep.equal([ { i: "tall ", p: 4 }, { i: "red ", p: 29 } @@ -47,7 +54,7 @@ describe("DiffCodec", function() { it("should delete text correctly", function(done) { this.before = ["hello beautiful world"]; this.after = ["hello world"]; - return this.DiffCodec.diffAsShareJsOp(this.before, this.after, function(error, ops) { + return this.DiffCodec.diffAsShareJsOp(this.before, this.after, (error, ops) => { expect(ops).to.deep.equal([{ d: "beautiful ", p: 6 @@ -61,7 +68,7 @@ describe("DiffCodec", function() { return it("should shift later deletes by the first deletes", function(done) { this.before = ["the tall boy played with the red ball"]; this.after = ["the boy played with the ball"]; - return this.DiffCodec.diffAsShareJsOp(this.before, this.after, function(error, ops) { + return this.DiffCodec.diffAsShareJsOp(this.before, this.after, (error, ops) => { expect(ops).to.deep.equal([ { d: "tall ", p: 4 }, { d: "red ", p: 24 } diff --git a/services/document-updater/test/unit/coffee/DispatchManager/DispatchManagerTests.js b/services/document-updater/test/unit/coffee/DispatchManager/DispatchManagerTests.js index 4ba0e2d16c..8b0c9afcf9 100644 --- a/services/document-updater/test/unit/coffee/DispatchManager/DispatchManagerTests.js +++ b/services/document-updater/test/unit/coffee/DispatchManager/DispatchManagerTests.js @@ -1,3 +1,10 @@ +/* eslint-disable + handle-callback-err, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns @@ -115,7 +122,7 @@ describe("DispatchManager", function() { }); }); - return describe("run", () => it("should call _waitForUpdateThenDispatchWorker until shutting down", function(done) { + return describe("run", function() { return it("should call _waitForUpdateThenDispatchWorker until shutting down", function(done) { let callCount = 0; this.worker._waitForUpdateThenDispatchWorker = callback => { if (callback == null) { callback = function(error) {}; } @@ -134,7 +141,7 @@ describe("DispatchManager", function() { var checkStatus = () => { if (!this.settings.shuttingDown) { // retry until shutdown setTimeout(checkStatus, 100); - return; + } else { this.worker._waitForUpdateThenDispatchWorker.callCount.should.equal(3); return done(); @@ -142,6 +149,6 @@ describe("DispatchManager", function() { }; return checkStatus(); - })); + }); }); }); }); diff --git a/services/document-updater/test/unit/coffee/DocumentManager/DocumentManagerTests.js b/services/document-updater/test/unit/coffee/DocumentManager/DocumentManagerTests.js index a338685948..cc13bbeb7a 100644 --- a/services/document-updater/test/unit/coffee/DocumentManager/DocumentManagerTests.js +++ b/services/document-updater/test/unit/coffee/DocumentManager/DocumentManagerTests.js @@ -1,3 +1,9 @@ +/* eslint-disable + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from @@ -60,7 +66,7 @@ describe("DocumentManager", function() { return this.lastUpdatedBy = 'last-author-id'; }); - afterEach(() => tk.reset()); + afterEach(function() { return tk.reset(); }); describe("flushAndDeleteDoc", function() { describe("successfully", function() { @@ -111,7 +117,7 @@ describe("DocumentManager", function() { }); }); - return describe("when ignoring flush errors", () => it("should remove the doc from redis", function(done) { + return describe("when ignoring flush errors", function() { return it("should remove the doc from redis", function(done) { return this.DocumentManager.flushAndDeleteDoc(this.project_id, this.doc_id, { ignoreFlushErrors: true }, error => { if (error != null) { return done(error); @@ -119,7 +125,7 @@ describe("DocumentManager", function() { this.RedisManager.removeDocFromMemory.called.should.equal(true); return done(); }); - })); + }); }); }); }); @@ -303,7 +309,7 @@ describe("DocumentManager", function() { }); }); - describe("setDoc", () => describe("with plain tex lines", function() { + describe("setDoc", function() { return describe("with plain tex lines", function() { beforeEach(function() { this.beforeLines = ["before", "lines"]; this.afterLines = ["after", "lines"]; @@ -417,7 +423,7 @@ describe("DocumentManager", function() { op.u.should.equal(true)); }); }); - })); + }); }); describe("acceptChanges", function() { beforeEach(function() { diff --git a/services/document-updater/test/unit/coffee/HistoryManager/HistoryManagerTests.js b/services/document-updater/test/unit/coffee/HistoryManager/HistoryManagerTests.js index d02b8fd295..64a07b06ae 100644 --- a/services/document-updater/test/unit/coffee/HistoryManager/HistoryManagerTests.js +++ b/services/document-updater/test/unit/coffee/HistoryManager/HistoryManagerTests.js @@ -1,3 +1,9 @@ +/* eslint-disable + mocha/no-nested-tests, + no-return-assign, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns diff --git a/services/document-updater/test/unit/coffee/HistoryRedisManager/HistoryRedisManagerTests.js b/services/document-updater/test/unit/coffee/HistoryRedisManager/HistoryRedisManagerTests.js index 70e95769a7..b5184a11e6 100644 --- a/services/document-updater/test/unit/coffee/HistoryRedisManager/HistoryRedisManagerTests.js +++ b/services/document-updater/test/unit/coffee/HistoryRedisManager/HistoryRedisManagerTests.js @@ -1,3 +1,10 @@ +/* eslint-disable + camelcase, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from diff --git a/services/document-updater/test/unit/coffee/HttpController/HttpControllerTests.js b/services/document-updater/test/unit/coffee/HttpController/HttpControllerTests.js index 9acbfb4325..5189f3515d 100644 --- a/services/document-updater/test/unit/coffee/HttpController/HttpControllerTests.js +++ b/services/document-updater/test/unit/coffee/HttpController/HttpControllerTests.js @@ -1,3 +1,9 @@ +/* eslint-disable + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns diff --git a/services/document-updater/test/unit/coffee/LockManager/CheckingTheLock.js b/services/document-updater/test/unit/coffee/LockManager/CheckingTheLock.js index 4c9c3f5f70..58392480d0 100644 --- a/services/document-updater/test/unit/coffee/LockManager/CheckingTheLock.js +++ b/services/document-updater/test/unit/coffee/LockManager/CheckingTheLock.js @@ -1,3 +1,10 @@ +/* eslint-disable + camelcase, + handle-callback-err, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns @@ -46,7 +53,7 @@ describe('LockManager - checking the lock', function(){ it('should return true if the key does not exists', function(done){ existsStub.yields(null, "0"); - return LockManager.checkLock(doc_id, function(err, free){ + return LockManager.checkLock(doc_id, (err, free) => { free.should.equal(true); return done(); }); @@ -54,7 +61,7 @@ describe('LockManager - checking the lock', function(){ return it('should return false if the key does exists', function(done){ existsStub.yields(null, "1"); - return LockManager.checkLock(doc_id, function(err, free){ + return LockManager.checkLock(doc_id, (err, free) => { free.should.equal(false); return done(); }); diff --git a/services/document-updater/test/unit/coffee/LockManager/ReleasingTheLock.js b/services/document-updater/test/unit/coffee/LockManager/ReleasingTheLock.js index 67616c062c..0cf4ef88b1 100644 --- a/services/document-updater/test/unit/coffee/LockManager/ReleasingTheLock.js +++ b/services/document-updater/test/unit/coffee/LockManager/ReleasingTheLock.js @@ -1,3 +1,10 @@ +/* eslint-disable + camelcase, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns diff --git a/services/document-updater/test/unit/coffee/LockManager/getLockTests.js b/services/document-updater/test/unit/coffee/LockManager/getLockTests.js index bdb301b8d5..0d99618e59 100644 --- a/services/document-updater/test/unit/coffee/LockManager/getLockTests.js +++ b/services/document-updater/test/unit/coffee/LockManager/getLockTests.js @@ -1,3 +1,11 @@ +/* eslint-disable + camelcase, + handle-callback-err, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from diff --git a/services/document-updater/test/unit/coffee/LockManager/tryLockTests.js b/services/document-updater/test/unit/coffee/LockManager/tryLockTests.js index cdc3e34f1e..9f6acf0002 100644 --- a/services/document-updater/test/unit/coffee/LockManager/tryLockTests.js +++ b/services/document-updater/test/unit/coffee/LockManager/tryLockTests.js @@ -1,3 +1,10 @@ +/* eslint-disable + camelcase, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns diff --git a/services/document-updater/test/unit/coffee/PersistenceManager/PersistenceManagerTests.js b/services/document-updater/test/unit/coffee/PersistenceManager/PersistenceManagerTests.js index cbef821472..68bedb4b2c 100644 --- a/services/document-updater/test/unit/coffee/PersistenceManager/PersistenceManagerTests.js +++ b/services/document-updater/test/unit/coffee/PersistenceManager/PersistenceManagerTests.js @@ -1,3 +1,9 @@ +/* eslint-disable + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns diff --git a/services/document-updater/test/unit/coffee/ProjectHistoryRedisManager/ProjectHistoryRedisManagerTests.js b/services/document-updater/test/unit/coffee/ProjectHistoryRedisManager/ProjectHistoryRedisManagerTests.js index 6187749c18..d3bba8f42f 100644 --- a/services/document-updater/test/unit/coffee/ProjectHistoryRedisManager/ProjectHistoryRedisManagerTests.js +++ b/services/document-updater/test/unit/coffee/ProjectHistoryRedisManager/ProjectHistoryRedisManagerTests.js @@ -1,3 +1,10 @@ +/* eslint-disable + camelcase, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from @@ -46,7 +53,7 @@ describe("ProjectHistoryRedisManager", function() { ); }); - afterEach(() => tk.reset()); + afterEach(function() { return tk.reset(); }); describe("queueOps", function() { beforeEach(function() { @@ -145,8 +152,8 @@ describe("ProjectHistoryRedisManager", function() { .should.equal(true); }); - describe("queueResyncProjectStructure", () => it("should queue an update", function() {})); + describe("queueResyncProjectStructure", function() { return it("should queue an update", function() {}); }); - return describe("queueResyncDocContent", () => it("should queue an update", function() {})); + return describe("queueResyncDocContent", function() { return it("should queue an update", function() {}); }); }); }); diff --git a/services/document-updater/test/unit/coffee/ProjectManager/flushAndDeleteProjectTests.js b/services/document-updater/test/unit/coffee/ProjectManager/flushAndDeleteProjectTests.js index ec572d7715..ebebf64740 100644 --- a/services/document-updater/test/unit/coffee/ProjectManager/flushAndDeleteProjectTests.js +++ b/services/document-updater/test/unit/coffee/ProjectManager/flushAndDeleteProjectTests.js @@ -1,3 +1,10 @@ +/* eslint-disable + camelcase, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from diff --git a/services/document-updater/test/unit/coffee/ProjectManager/flushProjectTests.js b/services/document-updater/test/unit/coffee/ProjectManager/flushProjectTests.js index 7160bbca10..7d74c61507 100644 --- a/services/document-updater/test/unit/coffee/ProjectManager/flushProjectTests.js +++ b/services/document-updater/test/unit/coffee/ProjectManager/flushProjectTests.js @@ -1,3 +1,11 @@ +/* eslint-disable + camelcase, + handle-callback-err, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from diff --git a/services/document-updater/test/unit/coffee/ProjectManager/getProjectDocsTests.js b/services/document-updater/test/unit/coffee/ProjectManager/getProjectDocsTests.js index 98fd1e825b..bb700a2a21 100644 --- a/services/document-updater/test/unit/coffee/ProjectManager/getProjectDocsTests.js +++ b/services/document-updater/test/unit/coffee/ProjectManager/getProjectDocsTests.js @@ -1,3 +1,9 @@ +/* eslint-disable + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns diff --git a/services/document-updater/test/unit/coffee/ProjectManager/updateProjectTests.js b/services/document-updater/test/unit/coffee/ProjectManager/updateProjectTests.js index 2c20c7322f..ffe8c49e97 100644 --- a/services/document-updater/test/unit/coffee/ProjectManager/updateProjectTests.js +++ b/services/document-updater/test/unit/coffee/ProjectManager/updateProjectTests.js @@ -1,3 +1,9 @@ +/* eslint-disable + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns diff --git a/services/document-updater/test/unit/coffee/RangesManager/RangesManagerTests.js b/services/document-updater/test/unit/coffee/RangesManager/RangesManagerTests.js index df6a146d9b..5634840221 100644 --- a/services/document-updater/test/unit/coffee/RangesManager/RangesManagerTests.js +++ b/services/document-updater/test/unit/coffee/RangesManager/RangesManagerTests.js @@ -1,3 +1,11 @@ +/* eslint-disable + camelcase, + handle-callback-err, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from diff --git a/services/document-updater/test/unit/coffee/RateLimitManager/RateLimitManager.js b/services/document-updater/test/unit/coffee/RateLimitManager/RateLimitManager.js index 1e5cd6a71c..ed41a4834a 100644 --- a/services/document-updater/test/unit/coffee/RateLimitManager/RateLimitManager.js +++ b/services/document-updater/test/unit/coffee/RateLimitManager/RateLimitManager.js @@ -1,3 +1,9 @@ +/* eslint-disable + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns diff --git a/services/document-updater/test/unit/coffee/RealTimeRedisManager/RealTimeRedisManagerTests.js b/services/document-updater/test/unit/coffee/RealTimeRedisManager/RealTimeRedisManagerTests.js index 135452f5a3..ae6cd4bba2 100644 --- a/services/document-updater/test/unit/coffee/RealTimeRedisManager/RealTimeRedisManagerTests.js +++ b/services/document-updater/test/unit/coffee/RealTimeRedisManager/RealTimeRedisManagerTests.js @@ -1,3 +1,10 @@ +/* eslint-disable + camelcase, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns diff --git a/services/document-updater/test/unit/coffee/RedisManager/RedisManagerTests.js b/services/document-updater/test/unit/coffee/RedisManager/RedisManagerTests.js index cf22958b05..7e8cf40d0e 100644 --- a/services/document-updater/test/unit/coffee/RedisManager/RedisManagerTests.js +++ b/services/document-updater/test/unit/coffee/RedisManager/RedisManagerTests.js @@ -1,3 +1,11 @@ +/* eslint-disable + camelcase, + mocha/no-identical-title, + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns @@ -66,6 +74,7 @@ describe("RedisManager", function() { constructor() { this.start = new Date(); } + done() { const timeSpan = new Date - this.start; return timeSpan; @@ -86,7 +95,7 @@ describe("RedisManager", function() { return this.callback = sinon.stub(); }); - afterEach(() => tk.reset()); + afterEach(function() { return tk.reset(); }); describe("getDoc", function() { beforeEach(function() { diff --git a/services/document-updater/test/unit/coffee/ShareJS/TextTransformTests.js b/services/document-updater/test/unit/coffee/ShareJS/TextTransformTests.js index 06b5699808..4989b77034 100644 --- a/services/document-updater/test/unit/coffee/ShareJS/TextTransformTests.js +++ b/services/document-updater/test/unit/coffee/ShareJS/TextTransformTests.js @@ -1,3 +1,10 @@ +/* eslint-disable + camelcase, + mocha/no-identical-title, + no-return-assign, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from @@ -218,38 +225,38 @@ describe("ShareJS text type", function() { }); }); - describe("comment / insert", () => it("should not do anything", function() { + describe("comment / insert", function() { return it("should not do anything", function() { const dest = []; text._tc(dest, { i: "foo", p: 6 }, { c: "bar", p: 3 }); return dest.should.deep.equal([{ i: "foo", p: 6 }]); - })); + }); }); - describe("comment / delete", () => it("should not do anything", function() { + describe("comment / delete", function() { return it("should not do anything", function() { const dest = []; text._tc(dest, { d: "foo", p: 6 }, { c: "bar", p: 3 }); return dest.should.deep.equal([{ d: "foo", p: 6 }]); - })); + }); }); - return describe("comment / comment", () => it("should not do anything", function() { + return describe("comment / comment", function() { return it("should not do anything", function() { const dest = []; text._tc(dest, { c: "foo", p: 6 }, { c: "bar", p: 3 }); return dest.should.deep.equal([{ c: "foo", p: 6 }]); - })); + }); }); }); describe("apply", function() { - it("should apply an insert", () => text.apply("foo", [{ i: "bar", p: 2 }]).should.equal("fobaro")); + it("should apply an insert", function() { return text.apply("foo", [{ i: "bar", p: 2 }]).should.equal("fobaro"); }); - it("should apply a delete", () => text.apply("foo123bar", [{ d: "123", p: 3 }]).should.equal("foobar")); + it("should apply a delete", function() { return text.apply("foo123bar", [{ d: "123", p: 3 }]).should.equal("foobar"); }); - it("should do nothing with a comment", () => text.apply("foo123bar", [{ c: "123", p: 3 }]).should.equal("foo123bar")); + it("should do nothing with a comment", function() { return text.apply("foo123bar", [{ c: "123", p: 3 }]).should.equal("foo123bar"); }); - it("should throw an error when deleted content does not match", () => ((() => text.apply("foo123bar", [{ d: "456", p: 3 }]))).should.throw(Error)); + it("should throw an error when deleted content does not match", function() { return ((() => text.apply("foo123bar", [{ d: "456", p: 3 }]))).should.throw(Error); }); - return it("should throw an error when comment content does not match", () => ((() => text.apply("foo123bar", [{ c: "456", p: 3 }]))).should.throw(Error)); + return it("should throw an error when comment content does not match", function() { return ((() => text.apply("foo123bar", [{ c: "456", p: 3 }]))).should.throw(Error); }); }); - return describe("applying ops and comments in different orders", () => it("should not matter which op or comment is applied first", function() { + return describe("applying ops and comments in different orders", function() { return it("should not matter which op or comment is applied first", function() { let length, p; let asc, end; let asc1, end1; @@ -263,7 +270,7 @@ describe("ShareJS text type", function() { const applySnapshot = (snapshot, op) => text.apply(snapshot, op); const applyRanges = function(rangesTracker, ops) { - for (let op of Array.from(ops)) { + for (const op of Array.from(ops)) { rangesTracker.applyOp(op, {}); } return rangesTracker; @@ -271,14 +278,14 @@ describe("ShareJS text type", function() { const commentsEqual = function(comments1, comments2) { if (comments1.length !== comments2.length) { return false; } - comments1.sort(function(a,b) { + comments1.sort((a,b) => { if ((a.offset - b.offset) === 0) { return a.length - b.length; } else { return a.offset - b.offset; } }); - comments2.sort(function(a,b) { + comments2.sort((a,b) => { if ((a.offset - b.offset) === 0) { return a.length - b.length; } else { @@ -299,19 +306,19 @@ describe("ShareJS text type", function() { const OPS = []; // Insert ops - for (p = 0, end = SNAPSHOT.length, asc = 0 <= end; asc ? p <= end : p >= end; asc ? p++ : p--) { + for (p = 0, end = SNAPSHOT.length, asc = end >= 0; asc ? p <= end : p >= end; asc ? p++ : p--) { OPS.push({i: "a", p}); OPS.push({i: "bc", p}); } - for (p = 0, end1 = SNAPSHOT.length-1, asc1 = 0 <= end1; asc1 ? p <= end1 : p >= end1; asc1 ? p++ : p--) { + for (p = 0, end1 = SNAPSHOT.length-1, asc1 = end1 >= 0; asc1 ? p <= end1 : p >= end1; asc1 ? p++ : p--) { var asc2, end2; - for (length = 1, end2 = SNAPSHOT.length - p, asc2 = 1 <= end2; asc2 ? length <= end2 : length >= end2; asc2 ? length++ : length--) { + for (length = 1, end2 = SNAPSHOT.length - p, asc2 = end2 >= 1; asc2 ? length <= end2 : length >= end2; asc2 ? length++ : length--) { OPS.push({d: SNAPSHOT.slice(p, p+length), p}); } } - for (p = 0, end3 = SNAPSHOT.length-1, asc3 = 0 <= end3; asc3 ? p <= end3 : p >= end3; asc3 ? p++ : p--) { + for (p = 0, end3 = SNAPSHOT.length-1, asc3 = end3 >= 0; asc3 ? p <= end3 : p >= end3; asc3 ? p++ : p--) { var asc4, end4; - for (length = 1, end4 = SNAPSHOT.length - p, asc4 = 1 <= end4; asc4 ? length <= end4 : length >= end4; asc4 ? length++ : length--) { + for (length = 1, end4 = SNAPSHOT.length - p, asc4 = end4 >= 1; asc4 ? length <= end4 : length >= end4; asc4 ? length++ : length--) { OPS.push({c: SNAPSHOT.slice(p, p+length), p, t: this.t}); } } @@ -321,7 +328,7 @@ describe("ShareJS text type", function() { for (var op1 of Array.from(OPS)) { result.push((() => { const result1 = []; - for (let op2 of Array.from(OPS)) { + for (const op2 of Array.from(OPS)) { const op1_t = transform(op1, op2, "left"); const op2_t = transform(op2, op1, "right"); @@ -354,5 +361,5 @@ describe("ShareJS text type", function() { } return result; })(); - })); + }); }); }); diff --git a/services/document-updater/test/unit/coffee/ShareJsDB/ShareJsDBTests.js b/services/document-updater/test/unit/coffee/ShareJsDB/ShareJsDBTests.js index 27f6729bdb..165e8fcdf0 100644 --- a/services/document-updater/test/unit/coffee/ShareJsDB/ShareJsDBTests.js +++ b/services/document-updater/test/unit/coffee/ShareJsDB/ShareJsDBTests.js @@ -1,3 +1,9 @@ +/* eslint-disable + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns @@ -107,7 +113,7 @@ describe("ShareJsDB", function() { }); }); - return describe("writeOps", () => describe("writing an op", function() { + return describe("writeOps", function() { return describe("writing an op", function() { beforeEach(function() { this.opData = { op: {p: 20, t: "foo"}, @@ -125,5 +131,5 @@ describe("ShareJsDB", function() { this.callback.called.should.equal(true); return (this.callback.args[0][0] != null).should.equal(false); }); - })); + }); }); }); diff --git a/services/document-updater/test/unit/coffee/ShareJsUpdateManager/ShareJsUpdateManagerTests.js b/services/document-updater/test/unit/coffee/ShareJsUpdateManager/ShareJsUpdateManagerTests.js index 4e0fbc52dd..c6a3fbac33 100644 --- a/services/document-updater/test/unit/coffee/ShareJsUpdateManager/ShareJsUpdateManagerTests.js +++ b/services/document-updater/test/unit/coffee/ShareJsUpdateManager/ShareJsUpdateManagerTests.js @@ -1,3 +1,9 @@ +/* eslint-disable + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns diff --git a/services/document-updater/test/unit/coffee/UpdateManager/UpdateManagerTests.js b/services/document-updater/test/unit/coffee/UpdateManager/UpdateManagerTests.js index ad195d5081..c5f89ab81c 100644 --- a/services/document-updater/test/unit/coffee/UpdateManager/UpdateManagerTests.js +++ b/services/document-updater/test/unit/coffee/UpdateManager/UpdateManagerTests.js @@ -1,3 +1,9 @@ +/* eslint-disable + no-return-assign, + no-unused-vars, +*/ +// TODO: This file was created by bulk-decaffeinate. +// Fix any style issues and re-enable lint. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from @@ -350,7 +356,7 @@ describe("UpdateManager", function() { }); - describe("_addProjectHistoryMetadataToOps", () => it("should add projectHistoryId, pathname and doc_length metadata to the ops", function() { + describe("_addProjectHistoryMetadataToOps", function() { return it("should add projectHistoryId, pathname and doc_length metadata to the ops", function() { const lines = [ 'some', 'test', @@ -387,7 +393,7 @@ describe("UpdateManager", function() { doc_length: 23 } // 14 - 'qux' + 'bazbaz' }]); -})); +}); }); return describe("lockUpdatesAndDo", function() { beforeEach(function() {