diff --git a/services/docstore/test/unit/coffee/DocArchiveManagerTests.js b/services/docstore/test/unit/coffee/DocArchiveManagerTests.js index a6602405bd..97cfa73140 100644 --- a/services/docstore/test/unit/coffee/DocArchiveManagerTests.js +++ b/services/docstore/test/unit/coffee/DocArchiveManagerTests.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 @@ -261,7 +269,7 @@ describe("DocArchiveManager", function() { this.MongoManager.getArchivedProjectDocs = sinon.stub().callsArgWith(1, null, this.archivedDocs); this.DocArchiveManager.unarchiveDoc = sinon.stub().callsArgWith(2, null); return this.DocArchiveManager.unArchiveAllDocs(this.project_id, err=> { - for (let doc of Array.from(this.archivedDocs)) { + for (const doc of Array.from(this.archivedDocs)) { this.DocArchiveManager.unarchiveDoc.calledWith(this.project_id, doc._id).should.equal(true); } should.not.exist(err); @@ -299,7 +307,7 @@ describe("DocArchiveManager", function() { it("should destroy all the docs", function(done){ this.DocArchiveManager.destroyDoc = sinon.stub().callsArgWith(2, null); return this.DocArchiveManager.destroyAllDocs(this.project_id, err=> { - for (let doc of Array.from(this.mixedDocs)) { + for (const doc of Array.from(this.mixedDocs)) { this.DocArchiveManager.destroyDoc.calledWith(this.project_id, doc._id).should.equal(true); } should.not.exist(err); @@ -337,7 +345,7 @@ describe("DocArchiveManager", function() { return expect(err).not.to.exist; }); - for (let doc of Array.from(this.mixedDocs)) { + for (const doc of Array.from(this.mixedDocs)) { sinon.assert.calledWith(this.MongoManager.destroyDoc, doc._id); } @@ -346,14 +354,14 @@ describe("DocArchiveManager", function() { }); describe("_s3DocToMongoDoc", function() { - describe("with the old schema", () => it("should return the docs lines", function(done) { - return this.DocArchiveManager._s3DocToMongoDoc(["doc", "lines"], function(error, doc) { + describe("with the old schema", function() { return it("should return the docs lines", function(done) { + return this.DocArchiveManager._s3DocToMongoDoc(["doc", "lines"], (error, doc) => { expect(doc).to.deep.equal({ lines: ["doc", "lines"] }); return done(); }); - })); + }); }); describe("with the new schema", function() { it("should return the doc lines and ranges", function(done) { @@ -362,7 +370,7 @@ describe("DocArchiveManager", function() { lines: ["doc", "lines"], ranges: {"json": "ranges"}, schema_v: 1 - }, function(error, doc) { + }, (error, doc) => { expect(doc).to.deep.equal({ lines: ["doc", "lines"], ranges: {"mongo": "ranges"} @@ -375,7 +383,7 @@ describe("DocArchiveManager", function() { return this.DocArchiveManager._s3DocToMongoDoc({ lines: ["doc", "lines"], schema_v: 1 - }, function(error, doc) { + }, (error, doc) => { expect(doc).to.deep.equal({ lines: ["doc", "lines"] }); @@ -384,23 +392,23 @@ describe("DocArchiveManager", function() { }); }); - return describe("with an unrecognised schema", () => it("should return an error", function(done) { + return describe("with an unrecognised schema", function() { return it("should return an error", function(done) { return this.DocArchiveManager._s3DocToMongoDoc({ schema_v: 2 - }, function(error, doc) { + }, (error, doc) => { expect(error).to.exist; return done(); }); - })); + }); }); }); return describe("_mongoDocToS3Doc", function() { - describe("with a valid doc", () => it("should return the json version", function(done) { + describe("with a valid doc", function() { return it("should return the json version", function(done) { let doc; return this.DocArchiveManager._mongoDocToS3Doc((doc = { lines: ["doc", "lines"], ranges: { "mock": "ranges" } - }), function(err, s3_doc) { + }), (err, s3_doc) => { expect(s3_doc).to.equal(JSON.stringify({ lines: ["doc", "lines"], ranges: { "mock": "ranges" }, @@ -409,7 +417,7 @@ describe("DocArchiveManager", function() { ); return done(); }); - })); + }); }); describe("with null bytes in the result", function() { beforeEach(function() { @@ -425,19 +433,19 @@ describe("DocArchiveManager", function() { return this.DocArchiveManager._mongoDocToS3Doc({ lines: ["doc", "lines"], ranges: { "mock": "ranges" } - }, function(err, s3_doc) { + }, (err, s3_doc) => { expect(err).to.exist; return done(); }); }); }); - return describe("without doc lines", () => it("should return an error", function(done) { - return this.DocArchiveManager._mongoDocToS3Doc({}, function(err, s3_doc) { + return describe("without doc lines", function() { return it("should return an error", function(done) { + return this.DocArchiveManager._mongoDocToS3Doc({}, (err, s3_doc) => { expect(err).to.exist; return done(); }); - })); + }); }); }); }); diff --git a/services/docstore/test/unit/coffee/DocManagerTests.js b/services/docstore/test/unit/coffee/DocManagerTests.js index bdeb97c98d..4130818601 100644 --- a/services/docstore/test/unit/coffee/DocManagerTests.js +++ b/services/docstore/test/unit/coffee/DocManagerTests.js @@ -1,3 +1,12 @@ +/* eslint-disable + camelcase, + handle-callback-err, + no-dupe-keys, + 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 @@ -143,7 +152,7 @@ describe("DocManager", function() { }); it("should error if inS3 is not set to true", function(done){ - return this.DocManager._getDoc(this.project_id, this.doc_id, {inS3: false}, function(err){ + return this.DocManager._getDoc(this.project_id, this.doc_id, {inS3: false}, (err) => { expect(err).to.exist; return done(); }); @@ -158,7 +167,7 @@ describe("DocManager", function() { }); return it("should not error if inS3 is set to true", function(done){ - return this.DocManager._getDoc(this.project_id, this.doc_id, {inS3: true}, function(err){ + return this.DocManager._getDoc(this.project_id, this.doc_id, {inS3: true}, (err) => { expect(err).to.not.exist; return done(); }); diff --git a/services/docstore/test/unit/coffee/HttpControllerTests.js b/services/docstore/test/unit/coffee/HttpControllerTests.js index 615ed5c798..27bb31a325 100644 --- a/services/docstore/test/unit/coffee/HttpControllerTests.js +++ b/services/docstore/test/unit/coffee/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 @@ -222,7 +228,7 @@ describe("HttpController", function() { }); }); - describe("getAllRanges", () => describe("normally", function() { + describe("getAllRanges", function() { return describe("normally", function() { beforeEach(function() { this.req.params = {project_id: this.project_id}; @@ -254,7 +260,7 @@ describe("HttpController", function() { }]) .should.equal(true); }); - })); + }); }); describe("updateDoc", function() { beforeEach(function() { diff --git a/services/docstore/test/unit/coffee/MongoManagerTests.js b/services/docstore/test/unit/coffee/MongoManagerTests.js index 0832c89d21..d7dabe3afb 100644 --- a/services/docstore/test/unit/coffee/MongoManagerTests.js +++ b/services/docstore/test/unit/coffee/MongoManagerTests.js @@ -1,3 +1,9 @@ +/* eslint-disable + handle-callback-err, + 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 @@ -111,9 +117,9 @@ describe("MongoManager", function() { return this.MongoManager.upsertIntoDocCollection(this.project_id, this.doc_id, {lines: this.lines}, err=> { const args = this.db.docs.update.args[0]; assert.deepEqual(args[0], {_id: ObjectId(this.doc_id)}); - assert.equal(args[1]["$set"]["lines"], this.lines); - assert.equal(args[1]["$inc"]["rev"], 1); - assert.deepEqual(args[1]["$set"]["project_id"], ObjectId(this.project_id)); + assert.equal(args[1].$set.lines, this.lines); + assert.equal(args[1].$inc.rev, 1); + assert.deepEqual(args[1].$set.project_id, ObjectId(this.project_id)); return done(); }); }); @@ -136,7 +142,7 @@ describe("MongoManager", function() { return this.MongoManager.markDocAsDeleted(this.project_id, this.doc_id, err=> { const args = this.db.docs.update.args[0]; assert.deepEqual(args[0], {_id: ObjectId(this.doc_id), project_id: ObjectId(this.project_id)}); - assert.equal(args[1]["$set"]["deleted"], true); + assert.equal(args[1].$set.deleted, true); return done(); }); }); diff --git a/services/docstore/test/unit/coffee/RangeManagerTests.js b/services/docstore/test/unit/coffee/RangeManagerTests.js index f98ca2cbe9..b67e535181 100644 --- a/services/docstore/test/unit/coffee/RangeManagerTests.js +++ b/services/docstore/test/unit/coffee/RangeManagerTests.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 @@ -137,20 +144,20 @@ describe("RangeManager", function() { return this.ranges_copy = this.RangeManager.jsonRangesToMongo(JSON.parse(JSON.stringify(this.ranges))); }); - describe("with a blank new range", () => it("should throw an error", function() { + describe("with a blank new range", function() { return it("should throw an error", function() { return expect(() => { return this.RangeManager.shouldUpdateRanges(this.ranges, null); }).to.throw(Error); - })); + }); }); - describe("with a blank old range", () => it("should treat it like {}", function() { + describe("with a blank old range", function() { return it("should treat it like {}", function() { this.RangeManager.shouldUpdateRanges(null, {}).should.equal(false); return this.RangeManager.shouldUpdateRanges(null, this.ranges).should.equal(true); - })); + }); }); - describe("with no changes", () => it("should return false", function() { + describe("with no changes", function() { return it("should return false", function() { return this.RangeManager.shouldUpdateRanges(this.ranges, this.ranges_copy).should.equal(false); - })); + }); }); return describe("with changes", function() { it("should return true when the change id changes", function() {