mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 14:49:01 +02:00
Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2 GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
@@ -18,8 +18,8 @@ const modulePath =
|
||||
const MockRequest = require('../helpers/MockRequest')
|
||||
const MockResponse = require('../helpers/MockResponse')
|
||||
|
||||
describe('ReferencesController', function() {
|
||||
beforeEach(function() {
|
||||
describe('ReferencesController', function () {
|
||||
beforeEach(function () {
|
||||
this.projectId = '2222'
|
||||
this.controller = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
@@ -51,8 +51,8 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('indexAll', function() {
|
||||
beforeEach(function() {
|
||||
describe('indexAll', function () {
|
||||
beforeEach(function () {
|
||||
this.req.body = { shouldBroadcast: false }
|
||||
this.ReferencesHandler.indexAll.callsArgWith(
|
||||
1,
|
||||
@@ -65,7 +65,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should not produce an error', function(done) {
|
||||
it('should not produce an error', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.sendStatus.callCount.should.equal(0)
|
||||
this.res.sendStatus.calledWith(500).should.equal(false)
|
||||
@@ -74,7 +74,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should return data', function(done) {
|
||||
it('should return data', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.json.callCount.should.equal(1)
|
||||
this.res.json.calledWith(this.fakeResponseData).should.equal(true)
|
||||
@@ -82,7 +82,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should call ReferencesHandler.indexAll', function(done) {
|
||||
it('should call ReferencesHandler.indexAll', function (done) {
|
||||
return this.call(() => {
|
||||
this.ReferencesHandler.indexAll.callCount.should.equal(1)
|
||||
this.ReferencesHandler.indexAll
|
||||
@@ -92,8 +92,8 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when shouldBroadcast is true', function() {
|
||||
beforeEach(function() {
|
||||
describe('when shouldBroadcast is true', function () {
|
||||
beforeEach(function () {
|
||||
this.ReferencesHandler.index.callsArgWith(
|
||||
2,
|
||||
null,
|
||||
@@ -102,14 +102,14 @@ describe('ReferencesController', function() {
|
||||
return (this.req.body.shouldBroadcast = true)
|
||||
})
|
||||
|
||||
it('should call EditorRealTimeController.emitToRoom', function(done) {
|
||||
it('should call EditorRealTimeController.emitToRoom', function (done) {
|
||||
return this.call(() => {
|
||||
this.EditorRealTimeController.emitToRoom.callCount.should.equal(1)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should not produce an error', function(done) {
|
||||
it('should not produce an error', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.sendStatus.callCount.should.equal(0)
|
||||
this.res.sendStatus.calledWith(500).should.equal(false)
|
||||
@@ -118,7 +118,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should still return data', function(done) {
|
||||
it('should still return data', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.json.callCount.should.equal(1)
|
||||
this.res.json.calledWith(this.fakeResponseData).should.equal(true)
|
||||
@@ -127,8 +127,8 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when shouldBroadcast is false', function() {
|
||||
beforeEach(function() {
|
||||
describe('when shouldBroadcast is false', function () {
|
||||
beforeEach(function () {
|
||||
this.ReferencesHandler.index.callsArgWith(
|
||||
2,
|
||||
null,
|
||||
@@ -137,14 +137,14 @@ describe('ReferencesController', function() {
|
||||
return (this.req.body.shouldBroadcast = false)
|
||||
})
|
||||
|
||||
it('should not call EditorRealTimeController.emitToRoom', function(done) {
|
||||
it('should not call EditorRealTimeController.emitToRoom', function (done) {
|
||||
return this.call(() => {
|
||||
this.EditorRealTimeController.emitToRoom.callCount.should.equal(0)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should not produce an error', function(done) {
|
||||
it('should not produce an error', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.sendStatus.callCount.should.equal(0)
|
||||
this.res.sendStatus.calledWith(500).should.equal(false)
|
||||
@@ -153,7 +153,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should still return data', function(done) {
|
||||
it('should still return data', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.json.callCount.should.equal(1)
|
||||
this.res.json.calledWith(this.fakeResponseData).should.equal(true)
|
||||
@@ -163,8 +163,8 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('there is no data', function() {
|
||||
beforeEach(function() {
|
||||
describe('there is no data', function () {
|
||||
beforeEach(function () {
|
||||
this.ReferencesHandler.indexAll.callsArgWith(1)
|
||||
return (this.call = callback => {
|
||||
this.controller.indexAll(this.req, this.res)
|
||||
@@ -172,14 +172,14 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should not call EditorRealTimeController.emitToRoom', function(done) {
|
||||
it('should not call EditorRealTimeController.emitToRoom', function (done) {
|
||||
return this.call(() => {
|
||||
this.EditorRealTimeController.emitToRoom.callCount.should.equal(0)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should not produce an error', function(done) {
|
||||
it('should not produce an error', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.sendStatus.callCount.should.equal(0)
|
||||
this.res.sendStatus.calledWith(500).should.equal(false)
|
||||
@@ -188,7 +188,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should send a response with an empty keys list', function(done) {
|
||||
it('should send a response with an empty keys list', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.json.called.should.equal(true)
|
||||
this.res.json
|
||||
@@ -199,16 +199,16 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('index', function() {
|
||||
beforeEach(function() {
|
||||
describe('index', function () {
|
||||
beforeEach(function () {
|
||||
return (this.call = callback => {
|
||||
this.controller.index(this.req, this.res)
|
||||
return callback()
|
||||
})
|
||||
})
|
||||
|
||||
describe('with docIds as an array and shouldBroadcast as false', function() {
|
||||
beforeEach(function() {
|
||||
describe('with docIds as an array and shouldBroadcast as false', function () {
|
||||
beforeEach(function () {
|
||||
return this.ReferencesHandler.index.callsArgWith(
|
||||
2,
|
||||
null,
|
||||
@@ -216,7 +216,7 @@ describe('ReferencesController', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should call ReferencesHandler.index', function(done) {
|
||||
it('should call ReferencesHandler.index', function (done) {
|
||||
return this.call(() => {
|
||||
this.ReferencesHandler.index.callCount.should.equal(1)
|
||||
this.ReferencesHandler.index
|
||||
@@ -226,7 +226,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should return data', function(done) {
|
||||
it('should return data', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.json.callCount.should.equal(1)
|
||||
this.res.json.calledWith(this.fakeResponseData).should.equal(true)
|
||||
@@ -234,7 +234,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should not produce an error', function(done) {
|
||||
it('should not produce an error', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.sendStatus.callCount.should.equal(0)
|
||||
this.res.sendStatus.calledWith(500).should.equal(false)
|
||||
@@ -243,15 +243,15 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should not call EditorRealTimController.emitToRoom', function(done) {
|
||||
it('should not call EditorRealTimController.emitToRoom', function (done) {
|
||||
return this.call(() => {
|
||||
this.EditorRealTimeController.emitToRoom.callCount.should.equal(0)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
describe('when ReferencesHandler.index produces an error', function() {
|
||||
beforeEach(function() {
|
||||
describe('when ReferencesHandler.index produces an error', function () {
|
||||
beforeEach(function () {
|
||||
return this.ReferencesHandler.index.callsArgWith(
|
||||
2,
|
||||
new Error('woops'),
|
||||
@@ -259,7 +259,7 @@ describe('ReferencesController', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should produce an error response', function(done) {
|
||||
it('should produce an error response', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.sendStatus.callCount.should.equal(1)
|
||||
this.res.sendStatus.calledWith(500).should.equal(true)
|
||||
@@ -269,8 +269,8 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when shouldBroadcast is true', function() {
|
||||
beforeEach(function() {
|
||||
describe('when shouldBroadcast is true', function () {
|
||||
beforeEach(function () {
|
||||
this.ReferencesHandler.index.callsArgWith(
|
||||
2,
|
||||
null,
|
||||
@@ -279,14 +279,14 @@ describe('ReferencesController', function() {
|
||||
return (this.req.body.shouldBroadcast = true)
|
||||
})
|
||||
|
||||
it('should call EditorRealTimeController.emitToRoom', function(done) {
|
||||
it('should call EditorRealTimeController.emitToRoom', function (done) {
|
||||
return this.call(() => {
|
||||
this.EditorRealTimeController.emitToRoom.callCount.should.equal(1)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should not produce an error', function(done) {
|
||||
it('should not produce an error', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.sendStatus.callCount.should.equal(0)
|
||||
this.res.sendStatus.calledWith(500).should.equal(false)
|
||||
@@ -295,7 +295,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should still return data', function(done) {
|
||||
it('should still return data', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.json.callCount.should.equal(1)
|
||||
this.res.json.calledWith(this.fakeResponseData).should.equal(true)
|
||||
@@ -304,12 +304,12 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('with missing docIds', function() {
|
||||
beforeEach(function() {
|
||||
describe('with missing docIds', function () {
|
||||
beforeEach(function () {
|
||||
return delete this.req.body.docIds
|
||||
})
|
||||
|
||||
it('should produce an error response', function(done) {
|
||||
it('should produce an error response', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.sendStatus.callCount.should.equal(1)
|
||||
this.res.sendStatus.calledWith(400).should.equal(true)
|
||||
@@ -317,7 +317,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should not call ReferencesHandler.index', function(done) {
|
||||
it('should not call ReferencesHandler.index', function (done) {
|
||||
return this.call(() => {
|
||||
this.ReferencesHandler.index.callCount.should.equal(0)
|
||||
return done()
|
||||
@@ -325,12 +325,12 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('with invalid docIds', function() {
|
||||
beforeEach(function() {
|
||||
describe('with invalid docIds', function () {
|
||||
beforeEach(function () {
|
||||
return (this.req.body.docIds = 42)
|
||||
})
|
||||
|
||||
it('should produce an error response', function(done) {
|
||||
it('should produce an error response', function (done) {
|
||||
return this.call(() => {
|
||||
this.res.sendStatus.callCount.should.equal(1)
|
||||
this.res.sendStatus.calledWith(400).should.equal(true)
|
||||
@@ -338,7 +338,7 @@ describe('ReferencesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should not call ReferencesHandler.index', function(done) {
|
||||
it('should not call ReferencesHandler.index', function (done) {
|
||||
return this.call(() => {
|
||||
this.ReferencesHandler.index.callCount.should.equal(0)
|
||||
return done()
|
||||
|
||||
Reference in New Issue
Block a user