Merge pull request #3942 from overleaf/prettier-trailing-comma
Set Prettier's "trailingComma" setting to "es5" GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
This commit is contained in:
@@ -22,15 +22,15 @@ describe('Csrf', function () {
|
||||
.callsArgWith(2, (this.err = { code: 'EBADCSRFTOKEN' }))
|
||||
this.Csrf = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
csurf: sinon.stub().returns(this.csurf_csrf)
|
||||
}
|
||||
csurf: sinon.stub().returns(this.csurf_csrf),
|
||||
},
|
||||
})
|
||||
this.csrf = new this.Csrf()
|
||||
this.next = sinon.stub()
|
||||
this.path = '/foo/bar'
|
||||
this.req = {
|
||||
path: this.path,
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
}
|
||||
return (this.res = {})
|
||||
})
|
||||
@@ -97,7 +97,7 @@ describe('Csrf', function () {
|
||||
let err
|
||||
this.Csrf = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
console: console,
|
||||
},
|
||||
requires: {
|
||||
csurf: (this.csurf = sinon
|
||||
@@ -106,8 +106,8 @@ describe('Csrf', function () {
|
||||
(this.csurf_csrf = sinon
|
||||
.stub()
|
||||
.callsArgWith(2, (err = { code: 'EOTHER' })))
|
||||
))
|
||||
}
|
||||
)),
|
||||
},
|
||||
})
|
||||
this.csrf = new this.Csrf()
|
||||
this.csrf.disableDefaultCsrfProtection(this.path, 'POST')
|
||||
@@ -131,13 +131,13 @@ describe('Csrf', function () {
|
||||
it('calls the callback without an error', function () {
|
||||
this.Csrf = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
console: console,
|
||||
},
|
||||
requires: {
|
||||
csurf: (this.csurf = sinon
|
||||
.stub()
|
||||
.returns((this.csurf_csrf = sinon.stub().callsArg(2))))
|
||||
}
|
||||
.returns((this.csurf_csrf = sinon.stub().callsArg(2)))),
|
||||
},
|
||||
})
|
||||
this.cb = sinon.stub()
|
||||
this.Csrf.validateRequest(this.req, this.cb)
|
||||
@@ -159,13 +159,13 @@ describe('Csrf', function () {
|
||||
it('calls the callback with `true`', function () {
|
||||
this.Csrf = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
console: console,
|
||||
},
|
||||
requires: {
|
||||
csurf: (this.csurf = sinon
|
||||
.stub()
|
||||
.returns((this.csurf_csrf = sinon.stub().callsArg(2))))
|
||||
}
|
||||
.returns((this.csurf_csrf = sinon.stub().callsArg(2)))),
|
||||
},
|
||||
})
|
||||
this.cb = sinon.stub()
|
||||
this.Csrf.validateToken('goodtoken', {}, this.cb)
|
||||
@@ -177,13 +177,13 @@ describe('Csrf', function () {
|
||||
it('calls the callback with an error', function () {
|
||||
this.Csrf = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
console: console,
|
||||
},
|
||||
requires: {
|
||||
csurf: (this.csurf = sinon
|
||||
.stub()
|
||||
.returns((this.csurf_csrf = sinon.stub().callsArg(2))))
|
||||
}
|
||||
.returns((this.csurf_csrf = sinon.stub().callsArg(2)))),
|
||||
},
|
||||
})
|
||||
this.cb = sinon.stub()
|
||||
this.Csrf.validateToken(null, {}, error => {
|
||||
|
||||
@@ -6,8 +6,8 @@ describe('Features', function () {
|
||||
beforeEach(function () {
|
||||
this.Features = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'settings-sharelatex': (this.settings = {})
|
||||
}
|
||||
'settings-sharelatex': (this.settings = {}),
|
||||
},
|
||||
})
|
||||
})
|
||||
describe('externalAuthenticationSystemUsed', function () {
|
||||
@@ -89,14 +89,14 @@ describe('Features', function () {
|
||||
beforeEach(function () {
|
||||
this.settings.apis = {
|
||||
linkedUrlProxy: {
|
||||
url: 'https://www.overleaf.com'
|
||||
url: 'https://www.overleaf.com',
|
||||
},
|
||||
references: {
|
||||
url: 'https://www.overleaf.com'
|
||||
url: 'https://www.overleaf.com',
|
||||
},
|
||||
v1: {
|
||||
url: 'https://www.overleaf.com'
|
||||
}
|
||||
url: 'https://www.overleaf.com',
|
||||
},
|
||||
}
|
||||
})
|
||||
it('should return true', function () {
|
||||
|
||||
@@ -26,16 +26,16 @@ describe('GeoIpLookup', function () {
|
||||
this.settings = {
|
||||
apis: {
|
||||
geoIpLookup: {
|
||||
url: 'http://lookup.com'
|
||||
}
|
||||
}
|
||||
url: 'http://lookup.com',
|
||||
},
|
||||
},
|
||||
}
|
||||
this.request = { get: sinon.stub() }
|
||||
this.GeoIpLookup = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
request: this.request,
|
||||
'settings-sharelatex': this.settings
|
||||
}
|
||||
'settings-sharelatex': this.settings,
|
||||
},
|
||||
})
|
||||
this.ipAddress = '123.456.789.123'
|
||||
|
||||
@@ -50,7 +50,7 @@ describe('GeoIpLookup', function () {
|
||||
latitude: 51.0,
|
||||
longitude: -0.0493,
|
||||
metro_code: '',
|
||||
area_code: ''
|
||||
area_code: '',
|
||||
})
|
||||
})
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('GeoIpLookup', function () {
|
||||
.calledWith({
|
||||
url: this.settings.apis.geoIpLookup.url + '/' + this.ipAddress,
|
||||
timeout: 1000,
|
||||
json: true
|
||||
json: true,
|
||||
})
|
||||
.should.equal(true)
|
||||
return done()
|
||||
@@ -90,7 +90,7 @@ describe('GeoIpLookup', function () {
|
||||
.calledWith({
|
||||
url: this.settings.apis.geoIpLookup.url + '/' + this.ipAddress,
|
||||
timeout: 1000,
|
||||
json: true
|
||||
json: true,
|
||||
})
|
||||
.should.equal(true)
|
||||
return done()
|
||||
|
||||
@@ -30,18 +30,18 @@ describe('LockManager - releasing the lock', function () {
|
||||
maxTestInterval: 1000,
|
||||
maxLockWaitTime: 10000,
|
||||
redisLockExpiry: 30,
|
||||
slowExecutionThreshold: 5000
|
||||
}
|
||||
slowExecutionThreshold: 5000,
|
||||
},
|
||||
},
|
||||
'@overleaf/metrics': {},
|
||||
'./RedisWrapper': {
|
||||
client() {
|
||||
return {
|
||||
auth() {},
|
||||
eval: deleteStub
|
||||
eval: deleteStub,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const LockManager = SandboxedModule.require(modulePath, { requires: mocks })
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('LockManager - getting the lock', function () {
|
||||
'./RedisWrapper': {
|
||||
client() {
|
||||
return { auth() {} }
|
||||
}
|
||||
},
|
||||
},
|
||||
'settings-sharelatex': {
|
||||
redis: {},
|
||||
@@ -37,14 +37,14 @@ describe('LockManager - getting the lock', function () {
|
||||
maxTestInterval: 1000,
|
||||
maxLockWaitTime: 10000,
|
||||
redisLockExpiry: 30,
|
||||
slowExecutionThreshold: 5000
|
||||
}
|
||||
slowExecutionThreshold: 5000,
|
||||
},
|
||||
},
|
||||
'@overleaf/metrics': {
|
||||
inc() {},
|
||||
gauge() {}
|
||||
}
|
||||
}
|
||||
gauge() {},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
this.callback = sinon.stub()
|
||||
|
||||
@@ -26,9 +26,9 @@ describe('LockManager - trying the lock', function () {
|
||||
client: () => {
|
||||
return {
|
||||
auth() {},
|
||||
set: (this.set = sinon.stub())
|
||||
set: (this.set = sinon.stub()),
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
'settings-sharelatex': {
|
||||
redis: {},
|
||||
@@ -37,13 +37,13 @@ describe('LockManager - trying the lock', function () {
|
||||
maxTestInterval: 1000,
|
||||
maxLockWaitTime: 10000,
|
||||
redisLockExpiry: 30,
|
||||
slowExecutionThreshold: 5000
|
||||
}
|
||||
slowExecutionThreshold: 5000,
|
||||
},
|
||||
},
|
||||
'@overleaf/metrics': {
|
||||
inc() {}
|
||||
}
|
||||
}
|
||||
inc() {},
|
||||
},
|
||||
},
|
||||
})
|
||||
this.callback = sinon.stub()
|
||||
this.key = 'lock:web:lockName:project-id}'
|
||||
|
||||
@@ -23,13 +23,13 @@ describe('ProxyManager', function () {
|
||||
this.settings = { proxyUrls: {} }
|
||||
this.request = sinon.stub().returns({
|
||||
on() {},
|
||||
pipe() {}
|
||||
pipe() {},
|
||||
})
|
||||
this.proxyManager = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
request: this.request
|
||||
}
|
||||
request: this.request,
|
||||
},
|
||||
})
|
||||
this.proxyPath = '/foo/bar'
|
||||
this.req = new MockRequest()
|
||||
@@ -42,7 +42,7 @@ describe('ProxyManager', function () {
|
||||
this.router = { get: sinon.stub() }
|
||||
this.settings.proxyUrls = {
|
||||
'/foo/bar': '',
|
||||
'/foo/:id': ''
|
||||
'/foo/:id': '',
|
||||
}
|
||||
this.proxyManager.apply(this.router)
|
||||
sinon.assert.calledTwice(this.router.get)
|
||||
@@ -53,11 +53,11 @@ describe('ProxyManager', function () {
|
||||
it('applies methods other than get', function () {
|
||||
this.router = {
|
||||
post: sinon.stub(),
|
||||
put: sinon.stub()
|
||||
put: sinon.stub(),
|
||||
}
|
||||
this.settings.proxyUrls = {
|
||||
'/foo/bar': { options: { method: 'post' } },
|
||||
'/foo/:id': { options: { method: 'put' } }
|
||||
'/foo/:id': { options: { method: 'put' } },
|
||||
}
|
||||
this.proxyManager.apply(this.router)
|
||||
sinon.assert.calledOnce(this.router.post)
|
||||
@@ -125,7 +125,7 @@ describe('ProxyManager', function () {
|
||||
baseUrl: 'api.v1',
|
||||
path(params) {
|
||||
return `/resource/${params.id}`
|
||||
}
|
||||
},
|
||||
}
|
||||
this.settings.proxyUrls['/res/:id'] = target
|
||||
this.req.url = '/res/123'
|
||||
@@ -139,14 +139,14 @@ describe('ProxyManager', function () {
|
||||
const target = {
|
||||
baseUrl: 'api.v1',
|
||||
path: '/foo',
|
||||
options: { foo: 'bar' }
|
||||
options: { foo: 'bar' },
|
||||
}
|
||||
this.req.url = '/foo'
|
||||
this.req.route.path = '/foo'
|
||||
this.proxyManager.createProxy(target)(this.req, this.res, this.next)
|
||||
return assertCalledWith(this.request, {
|
||||
foo: 'bar',
|
||||
url: 'api.v1/foo'
|
||||
url: 'api.v1/foo',
|
||||
})
|
||||
})
|
||||
|
||||
@@ -158,9 +158,9 @@ describe('ProxyManager', function () {
|
||||
this.proxyManager.createProxy(target)(this.req, this.res, this.next)
|
||||
return assertCalledWith(this.request, {
|
||||
headers: {
|
||||
Cookie: 'cookie'
|
||||
Cookie: 'cookie',
|
||||
},
|
||||
url: 'api.v1/foo'
|
||||
url: 'api.v1/foo',
|
||||
})
|
||||
})
|
||||
|
||||
@@ -168,7 +168,7 @@ describe('ProxyManager', function () {
|
||||
const target = {
|
||||
baseUrl: 'api.v1',
|
||||
path: '/foo',
|
||||
options: { method: 'post' }
|
||||
options: { method: 'post' },
|
||||
}
|
||||
this.req.url = '/foo'
|
||||
this.req.route.path = '/foo'
|
||||
@@ -176,10 +176,10 @@ describe('ProxyManager', function () {
|
||||
this.proxyManager.createProxy(target)(this.req, this.res, this.next)
|
||||
return assertCalledWith(this.request, {
|
||||
form: {
|
||||
foo: 'bar'
|
||||
foo: 'bar',
|
||||
},
|
||||
method: 'post',
|
||||
url: 'api.v1/foo'
|
||||
url: 'api.v1/foo',
|
||||
})
|
||||
})
|
||||
|
||||
@@ -187,7 +187,7 @@ describe('ProxyManager', function () {
|
||||
const target = {
|
||||
baseUrl: 'api.v1',
|
||||
path: '/foo',
|
||||
options: { method: 'put' }
|
||||
options: { method: 'put' },
|
||||
}
|
||||
this.req.url = '/foo'
|
||||
this.req.route.path = '/foo'
|
||||
@@ -195,10 +195,10 @@ describe('ProxyManager', function () {
|
||||
this.proxyManager.createProxy(target)(this.req, this.res, this.next)
|
||||
return assertCalledWith(this.request, {
|
||||
form: {
|
||||
foo: 'bar'
|
||||
foo: 'bar',
|
||||
},
|
||||
method: 'put',
|
||||
url: 'api.v1/foo'
|
||||
url: 'api.v1/foo',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -23,15 +23,15 @@ describe('RateLimiter', function () {
|
||||
web: {
|
||||
port: '1234',
|
||||
host: 'somewhere',
|
||||
password: 'password'
|
||||
}
|
||||
}
|
||||
password: 'password',
|
||||
},
|
||||
},
|
||||
}
|
||||
this.rclient = {
|
||||
incr: sinon.stub(),
|
||||
get: sinon.stub(),
|
||||
expire: sinon.stub(),
|
||||
exec: sinon.stub()
|
||||
exec: sinon.stub(),
|
||||
}
|
||||
this.rclient.multi = sinon.stub().returns(this.rclient)
|
||||
this.RedisWrapper = { client: sinon.stub().returns(this.rclient) }
|
||||
@@ -44,14 +44,14 @@ describe('RateLimiter', function () {
|
||||
this.requires = {
|
||||
'settings-sharelatex': this.settings,
|
||||
'@overleaf/metrics': (this.Metrics = { inc: sinon.stub() }),
|
||||
'./RedisWrapper': this.RedisWrapper
|
||||
'./RedisWrapper': this.RedisWrapper,
|
||||
}
|
||||
|
||||
this.details = {
|
||||
endpointName: this.endpointName,
|
||||
subjectName: this.subject,
|
||||
throttle: this.throttleLimit,
|
||||
timeInterval: this.timeInterval
|
||||
timeInterval: this.timeInterval,
|
||||
}
|
||||
return (this.key = `RateLimiter:${this.endpointName}:{${this.subject}}`)
|
||||
})
|
||||
@@ -62,7 +62,7 @@ describe('RateLimiter', function () {
|
||||
return sinon.stub().callsArgWith(1, null, 0, 22)
|
||||
}
|
||||
return (this.limiter = SandboxedModule.require(modulePath, {
|
||||
requires: this.requires
|
||||
requires: this.requires,
|
||||
}))
|
||||
})
|
||||
|
||||
@@ -98,9 +98,9 @@ describe('RateLimiter', function () {
|
||||
}
|
||||
return (this.limiter = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
console: console,
|
||||
},
|
||||
requires: this.requires
|
||||
requires: this.requires,
|
||||
}))
|
||||
})
|
||||
|
||||
@@ -123,7 +123,7 @@ describe('RateLimiter', function () {
|
||||
{ endpointName: this.endpointName },
|
||||
(err, should) => {
|
||||
sinon.assert.calledWith(this.Metrics.inc, `rate-limit-hit`, 1, {
|
||||
path: this.endpointName
|
||||
path: this.endpointName,
|
||||
})
|
||||
return done()
|
||||
}
|
||||
@@ -138,9 +138,9 @@ describe('RateLimiter', function () {
|
||||
}
|
||||
return (this.limiter = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
console: console,
|
||||
},
|
||||
requires: this.requires
|
||||
requires: this.requires,
|
||||
}))
|
||||
})
|
||||
|
||||
|
||||
@@ -20,23 +20,23 @@ describe('Translations', function () {
|
||||
subdomainLang: {
|
||||
www: { lngCode: 'en', url: 'https://www.sharelatex.com' },
|
||||
fr: { lngCode: 'fr', url: 'https://fr.sharelatex.com' },
|
||||
da: { lngCode: 'da', url: 'https://da.sharelatex.com' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
da: { lngCode: 'da', url: 'https://da.sharelatex.com' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
req = {
|
||||
url: '/',
|
||||
headers: {
|
||||
'accept-language': ''
|
||||
}
|
||||
'accept-language': '',
|
||||
},
|
||||
}
|
||||
res = {
|
||||
locals: {},
|
||||
getHeader: () => {},
|
||||
setHeader: () => {}
|
||||
setHeader: () => {},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -62,7 +62,7 @@ describe('Translations', function () {
|
||||
it('works', function () {
|
||||
expect(
|
||||
req.i18n.t('please_confirm_email', {
|
||||
emailAddress: 'foo@example.com'
|
||||
emailAddress: 'foo@example.com',
|
||||
})
|
||||
).to.equal(
|
||||
'Please confirm your email foo@example.com by clicking on the link in the confirmation email '
|
||||
@@ -75,7 +75,7 @@ describe('Translations', function () {
|
||||
expect(
|
||||
req.i18n.t('faq_how_does_free_trial_works_answer', {
|
||||
appName: 'Overleaf',
|
||||
len: '5'
|
||||
len: '5',
|
||||
})
|
||||
).to.equal(
|
||||
'You get full access to your chosen Overleaf plan during your 5-day free trial. There is no obligation to continue beyond the trial. Your card will be charged at the end of your 5 day trial unless you cancel before then. You can cancel via your subscription settings.'
|
||||
@@ -85,7 +85,7 @@ describe('Translations', function () {
|
||||
it('disables escaping', function () {
|
||||
expect(
|
||||
req.i18n.t('admin_user_created_message', {
|
||||
link: 'http://google.com'
|
||||
link: 'http://google.com',
|
||||
})
|
||||
).to.equal(
|
||||
'Created admin user, <a href="http://google.com">Log in here</a> to continue'
|
||||
|
||||
Reference in New Issue
Block a user