mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
decaffeinate: Run post-processing cleanups on ApplyUpdateTests.coffee and 18 other files
This commit is contained in:
parent
d318e4fd0e
commit
5443450abb
19 changed files with 187 additions and 68 deletions
|
@ -1,3 +1,10 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
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
|
||||
|
|
|
@ -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:
|
||||
* DS101: Remove unnecessary use of Array.from
|
||||
|
@ -71,7 +78,7 @@ describe("clientTracking", function() {
|
|||
row: (this.row = 42),
|
||||
column: (this.column = 36),
|
||||
doc_id: this.doc_id
|
||||
}, function(error) {
|
||||
}, (error) => {
|
||||
if (error != null) { throw error; }
|
||||
return setTimeout(cb, 300);
|
||||
});
|
||||
|
@ -94,7 +101,7 @@ describe("clientTracking", function() {
|
|||
|
||||
return it("should record the update in getConnectedUsers", function(done) {
|
||||
return this.clientB.emit("clientTracking.getConnectedUsers", (error, users) => {
|
||||
for (let user of Array.from(users)) {
|
||||
for (const user of Array.from(users)) {
|
||||
if (user.client_id === this.clientA.publicId) {
|
||||
expect(user.cursorData).to.deep.equal({
|
||||
row: this.row,
|
||||
|
@ -167,7 +174,7 @@ describe("clientTracking", function() {
|
|||
row: (this.row = 42),
|
||||
column: (this.column = 36),
|
||||
doc_id: this.doc_id
|
||||
}, function(error) {
|
||||
}, (error) => {
|
||||
if (error != null) { throw error; }
|
||||
return setTimeout(cb, 300);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
*/
|
||||
// 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
|
||||
|
@ -44,11 +49,11 @@ describe("DrainManagerTests", function() {
|
|||
});
|
||||
|
||||
// trigger and check cleanup
|
||||
it("should have disconnected all previous clients", done => RealTimeClient.getConnectedClients(function(error, data) {
|
||||
it("should have disconnected all previous clients", function(done) { return RealTimeClient.getConnectedClients((error, data) => {
|
||||
if (error) { return done(error); }
|
||||
expect(data.length).to.equal(0);
|
||||
return done();
|
||||
}));
|
||||
}); });
|
||||
|
||||
return describe("with two clients in the project", function() {
|
||||
beforeEach(function(done) {
|
||||
|
@ -87,9 +92,9 @@ describe("DrainManagerTests", function() {
|
|||
], done);
|
||||
});
|
||||
|
||||
afterEach(done => drain(0, done)); // reset drain
|
||||
afterEach(function(done) { return drain(0, done); }); // reset drain
|
||||
|
||||
it("should not timeout", () => expect(true).to.equal(true));
|
||||
it("should not timeout", function() { return expect(true).to.equal(true); });
|
||||
|
||||
return it("should not have disconnected", function() {
|
||||
expect(this.clientA.socket.connected).to.equal(true);
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
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
|
||||
|
@ -19,7 +25,7 @@ const rclientRT = redis.createClient(settings.redis.realtime);
|
|||
const KeysRT = settings.redis.realtime.key_schema;
|
||||
|
||||
describe("EarlyDisconnect", function() {
|
||||
before(done => MockDocUpdaterServer.run(done));
|
||||
before(function(done) { return MockDocUpdaterServer.run(done); });
|
||||
|
||||
describe("when the client disconnects before joinProject completes", function() {
|
||||
before(function() {
|
||||
|
@ -51,7 +57,7 @@ describe("EarlyDisconnect", function() {
|
|||
},
|
||||
|
||||
cb => {
|
||||
this.clientA.emit("joinProject", {project_id: this.project_id}, (function() {}));
|
||||
this.clientA.emit("joinProject", {project_id: this.project_id}, (() => {}));
|
||||
// disconnect before joinProject completes
|
||||
this.clientA.on("disconnect", () => cb());
|
||||
return this.clientA.disconnect();
|
||||
|
@ -110,7 +116,7 @@ describe("EarlyDisconnect", function() {
|
|||
},
|
||||
|
||||
cb => {
|
||||
this.clientA.emit("joinDoc", this.doc_id, (function() {}));
|
||||
this.clientA.emit("joinDoc", this.doc_id, (() => {}));
|
||||
// disconnect before joinDoc completes
|
||||
this.clientA.on("disconnect", () => cb());
|
||||
return this.clientA.disconnect();
|
||||
|
@ -182,7 +188,7 @@ describe("EarlyDisconnect", function() {
|
|||
row: 42,
|
||||
column: 36,
|
||||
doc_id: this.doc_id
|
||||
}, (function() {}));
|
||||
}, (() => {}));
|
||||
// disconnect before updateClientPosition completes
|
||||
this.clientA.on("disconnect", () => cb());
|
||||
return this.clientA.disconnect();
|
||||
|
@ -198,7 +204,7 @@ describe("EarlyDisconnect", function() {
|
|||
// we can not force the race condition, so we have to try many times
|
||||
return Array.from(Array.from({length: 20}).map((_, i) => i+1)).map((attempt) =>
|
||||
it(`should not show the client as connected (race ${attempt})`, function(done) {
|
||||
rclientRT.smembers(KeysRT.clientsInProject({project_id: this.project_id}), function(err, results) {
|
||||
rclientRT.smembers(KeysRT.clientsInProject({project_id: this.project_id}), (err, results) => {
|
||||
if (err) { return done(err); }
|
||||
expect(results).to.deep.equal([]);
|
||||
return done();
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
*/
|
||||
// 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
|
||||
|
@ -15,17 +20,17 @@ const RealTimeClient = require("./helpers/RealTimeClient");
|
|||
const FixturesManager = require("./helpers/FixturesManager");
|
||||
|
||||
describe('HttpControllerTests', function() {
|
||||
describe('without a user', () => it('should return 404 for the client view', function(done) {
|
||||
describe('without a user', function() { return it('should return 404 for the client view', function(done) {
|
||||
const client_id = 'not-existing';
|
||||
return request.get({
|
||||
url: `/clients/${client_id}`,
|
||||
json: true
|
||||
}, function(error, response, data) {
|
||||
}, (error, response, data) => {
|
||||
if (error) { return done(error); }
|
||||
expect(response.statusCode).to.equal(404);
|
||||
return done();
|
||||
});
|
||||
}));
|
||||
}); });
|
||||
|
||||
return describe('with a user and after joining a project', function() {
|
||||
before(function(done) {
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
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
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
*/
|
||||
// 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
|
||||
|
@ -79,7 +85,7 @@ describe("joinProject", function() {
|
|||
return it("should have marked the user as connected", function(done) {
|
||||
return this.client.emit("clientTracking.getConnectedUsers", (error, users) => {
|
||||
let connected = false;
|
||||
for (let user of Array.from(users)) {
|
||||
for (const user of Array.from(users)) {
|
||||
if ((user.client_id === this.client.publicId) && (user.user_id === this.user_id)) {
|
||||
connected = true;
|
||||
break;
|
||||
|
|
|
@ -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
|
||||
|
@ -73,7 +81,7 @@ describe("leaveDoc", function() {
|
|||
|
||||
describe("then leaving the doc", function() {
|
||||
beforeEach(function(done) {
|
||||
return this.client.emit("leaveDoc", this.doc_id, function(error) {
|
||||
return this.client.emit("leaveDoc", this.doc_id, (error) => {
|
||||
if (error != null) { throw error; }
|
||||
return done();
|
||||
});
|
||||
|
@ -89,15 +97,15 @@ describe("leaveDoc", function() {
|
|||
|
||||
describe("when sending a leaveDoc request before the previous joinDoc request has completed", function() {
|
||||
beforeEach(function(done) {
|
||||
this.client.emit("leaveDoc", this.doc_id, function() {});
|
||||
this.client.emit("joinDoc", this.doc_id, function() {});
|
||||
return this.client.emit("leaveDoc", this.doc_id, function(error) {
|
||||
this.client.emit("leaveDoc", this.doc_id, () => {});
|
||||
this.client.emit("joinDoc", this.doc_id, () => {});
|
||||
return this.client.emit("leaveDoc", this.doc_id, (error) => {
|
||||
if (error != null) { throw error; }
|
||||
return done();
|
||||
});
|
||||
});
|
||||
|
||||
it("should not trigger an error", () => sinon.assert.neverCalledWith(logger.error, sinon.match.any, "not subscribed - shouldn't happen"));
|
||||
it("should not trigger an error", function() { return sinon.assert.neverCalledWith(logger.error, sinon.match.any, "not subscribed - shouldn't happen"); });
|
||||
|
||||
return it("should have left the doc room", function(done) {
|
||||
return RealTimeClient.getConnectedClient(this.client.socket.sessionid, (error, client) => {
|
||||
|
@ -109,13 +117,13 @@ describe("leaveDoc", function() {
|
|||
|
||||
return describe("when sending a leaveDoc for a room the client has not joined ", function() {
|
||||
beforeEach(function(done) {
|
||||
return this.client.emit("leaveDoc", this.other_doc_id, function(error) {
|
||||
return this.client.emit("leaveDoc", this.other_doc_id, (error) => {
|
||||
if (error != null) { throw error; }
|
||||
return done();
|
||||
});
|
||||
});
|
||||
|
||||
return it("should trigger a low level message only", () => sinon.assert.calledWith(logger.log, sinon.match.any, "ignoring request from client to leave room it is not in"));
|
||||
return it("should trigger a low level message only", function() { return sinon.assert.calledWith(logger.log, sinon.match.any, "ignoring request from client to leave room it is not in"); });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
no-throw-literal,
|
||||
*/
|
||||
// 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
|
||||
|
@ -15,7 +22,7 @@ const redis = require("redis-sharelatex");
|
|||
const rclient = redis.createClient(settings.redis.pubsub);
|
||||
|
||||
describe("leaveProject", function() {
|
||||
before(done => MockDocUpdaterServer.run(done));
|
||||
before(function(done) { return MockDocUpdaterServer.run(done); });
|
||||
|
||||
describe("with other clients in the project", function() {
|
||||
before(function(done) {
|
||||
|
@ -96,7 +103,7 @@ describe("leaveProject", function() {
|
|||
|
||||
it("should no longer list the client in connected users", function(done) {
|
||||
return this.clientB.emit("clientTracking.getConnectedUsers", (error, users) => {
|
||||
for (let user of Array.from(users)) {
|
||||
for (const user of Array.from(users)) {
|
||||
if (user.client_id === this.clientA.publicId) {
|
||||
throw "Expected clientA to not be listed in connected users";
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
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
|
||||
|
@ -14,7 +20,7 @@ const redis = require("redis-sharelatex");
|
|||
const rclient = redis.createClient(settings.redis.pubsub);
|
||||
|
||||
describe("PubSubRace", function() {
|
||||
before(done => MockDocUpdaterServer.run(done));
|
||||
before(function(done) { return MockDocUpdaterServer.run(done); });
|
||||
|
||||
describe("when the client leaves a doc before joinDoc completes", function() {
|
||||
before(function(done) {
|
||||
|
@ -50,7 +56,7 @@ describe("PubSubRace", function() {
|
|||
},
|
||||
|
||||
cb => {
|
||||
this.clientA.emit("joinDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, () => {});
|
||||
// leave before joinDoc completes
|
||||
return this.clientA.emit("leaveDoc", this.doc_id, cb);
|
||||
},
|
||||
|
@ -106,15 +112,15 @@ describe("PubSubRace", function() {
|
|||
},
|
||||
|
||||
cb => {
|
||||
this.clientA.emit("joinDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, () => {});
|
||||
return this.clientA.emit("leaveDoc", this.doc_id, cb);
|
||||
},
|
||||
|
||||
|
@ -169,14 +175,14 @@ describe("PubSubRace", function() {
|
|||
},
|
||||
|
||||
cb => {
|
||||
this.clientA.emit("joinDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, function() {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("joinDoc", this.doc_id, () => {});
|
||||
this.clientA.emit("leaveDoc", this.doc_id, () => {});
|
||||
return this.clientA.emit("joinDoc", this.doc_id, cb);
|
||||
},
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
*/
|
||||
// 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
|
||||
|
@ -10,7 +15,7 @@ const RealTimeClient = require("./helpers/RealTimeClient");
|
|||
const FixturesManager = require("./helpers/FixturesManager");
|
||||
|
||||
|
||||
describe("Router", () => describe("joinProject", function() {
|
||||
describe("Router", function() { return describe("joinProject", function() {
|
||||
describe("when there is no callback provided", function() {
|
||||
after(function() {
|
||||
return process.removeListener('unhandledRejection', this.onUnhandled);
|
||||
|
@ -50,7 +55,7 @@ describe("Router", () => describe("joinProject", function() {
|
|||
], done);
|
||||
});
|
||||
|
||||
return it("should keep on going", () => expect('still running').to.exist);
|
||||
return it("should keep on going", function() { return expect('still running').to.exist; });
|
||||
});
|
||||
|
||||
return describe("when there are too many arguments", function() {
|
||||
|
@ -98,4 +103,4 @@ describe("Router", () => describe("joinProject", function() {
|
|||
return expect(this.error.message).to.equal('unexpected arguments');
|
||||
});
|
||||
});
|
||||
}));
|
||||
}); });
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/* eslint-disable
|
||||
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
|
||||
|
@ -18,10 +23,10 @@ describe('SessionSockets', function() {
|
|||
});
|
||||
|
||||
describe('without cookies', function() {
|
||||
before(() => RealTimeClient.cookie = null);
|
||||
before(function() { return RealTimeClient.cookie = null; });
|
||||
|
||||
return it('should return a lookup error', function(done) {
|
||||
return this.checkSocket(function(error) {
|
||||
return this.checkSocket((error) => {
|
||||
expect(error).to.exist;
|
||||
expect(error.message).to.equal('invalid session');
|
||||
return done();
|
||||
|
@ -30,10 +35,10 @@ describe('SessionSockets', function() {
|
|||
});
|
||||
|
||||
describe('with a different cookie', function() {
|
||||
before(() => RealTimeClient.cookie = "some.key=someValue");
|
||||
before(function() { return RealTimeClient.cookie = "some.key=someValue"; });
|
||||
|
||||
return it('should return a lookup error', function(done) {
|
||||
return this.checkSocket(function(error) {
|
||||
return this.checkSocket((error) => {
|
||||
expect(error).to.exist;
|
||||
expect(error.message).to.equal('invalid session');
|
||||
return done();
|
||||
|
@ -43,7 +48,7 @@ describe('SessionSockets', function() {
|
|||
|
||||
describe('with an invalid cookie', function() {
|
||||
before(function(done) {
|
||||
RealTimeClient.setSession({}, function(error) {
|
||||
RealTimeClient.setSession({}, (error) => {
|
||||
if (error) { return done(error); }
|
||||
RealTimeClient.cookie = `${Settings.cookieName}=${
|
||||
RealTimeClient.cookie.slice(17, 49)
|
||||
|
@ -54,7 +59,7 @@ describe('SessionSockets', function() {
|
|||
});
|
||||
|
||||
return it('should return a lookup error', function(done) {
|
||||
return this.checkSocket(function(error) {
|
||||
return this.checkSocket((error) => {
|
||||
expect(error).to.exist;
|
||||
expect(error.message).to.equal('invalid session');
|
||||
return done();
|
||||
|
@ -63,10 +68,10 @@ describe('SessionSockets', function() {
|
|||
});
|
||||
|
||||
describe('with a valid cookie and no matching session', function() {
|
||||
before(() => RealTimeClient.cookie = `${Settings.cookieName}=unknownId`);
|
||||
before(function() { return RealTimeClient.cookie = `${Settings.cookieName}=unknownId`; });
|
||||
|
||||
return it('should return a lookup error', function(done) {
|
||||
return this.checkSocket(function(error) {
|
||||
return this.checkSocket((error) => {
|
||||
expect(error).to.exist;
|
||||
expect(error.message).to.equal('invalid session');
|
||||
return done();
|
||||
|
@ -81,7 +86,7 @@ describe('SessionSockets', function() {
|
|||
});
|
||||
|
||||
return it('should not return an error', function(done) {
|
||||
return this.checkSocket(function(error) {
|
||||
return this.checkSocket((error) => {
|
||||
expect(error).to.not.exist;
|
||||
return done();
|
||||
});
|
||||
|
|
|
@ -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:
|
||||
* DS101: Remove unnecessary use of Array.from
|
||||
|
@ -12,7 +18,7 @@ const {
|
|||
|
||||
const RealTimeClient = require("./helpers/RealTimeClient");
|
||||
|
||||
describe("Session", () => describe("with an established session", function() {
|
||||
describe("Session", function() { return describe("with an established session", function() {
|
||||
before(function(done) {
|
||||
this.user_id = "mock-user-id";
|
||||
RealTimeClient.setSession({
|
||||
|
@ -38,7 +44,7 @@ describe("Session", () => describe("with an established session", function() {
|
|||
return it("should appear in the list of connected clients", function(done) {
|
||||
return RealTimeClient.getConnectedClients((error, clients) => {
|
||||
let included = false;
|
||||
for (let client of Array.from(clients)) {
|
||||
for (const client of Array.from(clients)) {
|
||||
if (client.client_id === this.client.socket.sessionid) {
|
||||
included = true;
|
||||
break;
|
||||
|
@ -48,4 +54,4 @@ describe("Session", () => describe("with an established session", function() {
|
|||
return done();
|
||||
});
|
||||
});
|
||||
}));
|
||||
}); });
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
*/
|
||||
// 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
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
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
|
||||
|
@ -28,7 +35,7 @@ module.exports = (MockDocUpdaterServer = {
|
|||
const {project_id, doc_id} = req.params;
|
||||
let {fromVersion} = req.query;
|
||||
fromVersion = parseInt(fromVersion, 10);
|
||||
return MockDocUpdaterServer.getDocument(project_id, doc_id, fromVersion, function(error, data) {
|
||||
return MockDocUpdaterServer.getDocument(project_id, doc_id, fromVersion, (error, data) => {
|
||||
if (error != null) { return next(error); }
|
||||
return res.json(data);
|
||||
});
|
||||
|
@ -36,7 +43,7 @@ module.exports = (MockDocUpdaterServer = {
|
|||
|
||||
deleteProjectRequest(req, res, next) {
|
||||
const {project_id} = req.params;
|
||||
return MockDocUpdaterServer.deleteProject(project_id, function(error) {
|
||||
return MockDocUpdaterServer.deleteProject(project_id, (error) => {
|
||||
if (error != null) { return next(error); }
|
||||
return res.sendStatus(204);
|
||||
});
|
||||
|
@ -51,10 +58,10 @@ module.exports = (MockDocUpdaterServer = {
|
|||
const app = express();
|
||||
app.get("/project/:project_id/doc/:doc_id", MockDocUpdaterServer.getDocumentRequest);
|
||||
app.delete("/project/:project_id", MockDocUpdaterServer.deleteProjectRequest);
|
||||
return app.listen(3003, function(error) {
|
||||
return app.listen(3003, (error) => {
|
||||
MockDocUpdaterServer.running = true;
|
||||
return callback(error);
|
||||
}).on("error", function(error) {
|
||||
}).on("error", (error) => {
|
||||
console.error("error starting MockDocUpdaterServer:", error.message);
|
||||
return process.exit(1);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
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
|
||||
|
@ -32,7 +39,7 @@ module.exports = (MockWebServer = {
|
|||
if (project_id === 'rate-limited') {
|
||||
return res.status(429).send();
|
||||
} else {
|
||||
return MockWebServer.joinProject(project_id, user_id, function(error, project, privilegeLevel) {
|
||||
return MockWebServer.joinProject(project_id, user_id, (error, project, privilegeLevel) => {
|
||||
if (error != null) { return next(error); }
|
||||
return res.json({
|
||||
project,
|
||||
|
@ -50,10 +57,10 @@ module.exports = (MockWebServer = {
|
|||
}
|
||||
const app = express();
|
||||
app.post("/project/:project_id/join", MockWebServer.joinProjectRequest);
|
||||
return app.listen(3000, function(error) {
|
||||
return app.listen(3000, (error) => {
|
||||
MockWebServer.running = true;
|
||||
return callback(error);
|
||||
}).on("error", function(error) {
|
||||
}).on("error", (error) => {
|
||||
console.error("error starting MockWebServer:", error.message);
|
||||
return process.exit(1);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/* eslint-disable
|
||||
camelcase,
|
||||
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
|
||||
|
@ -27,7 +34,7 @@ io.util.request = function() {
|
|||
if (Client.cookie != null) {
|
||||
return xhr.setRequestHeader("Cookie", Client.cookie);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
return xhr;
|
||||
};
|
||||
|
||||
|
@ -38,7 +45,7 @@ module.exports = (Client = {
|
|||
if (callback == null) { callback = function(error) {}; }
|
||||
const sessionId = uid(24);
|
||||
session.cookie = {};
|
||||
return rclient.set("sess:" + sessionId, JSON.stringify(session), function(error) {
|
||||
return rclient.set("sess:" + sessionId, JSON.stringify(session), (error) => {
|
||||
if (error != null) { return callback(error); }
|
||||
const secret = Settings.security.sessionSecret;
|
||||
const cookieKey = 's:' + signature.sign(sessionId, secret);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
*/
|
||||
// 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
|
||||
|
|
Loading…
Reference in a new issue