Merge pull request #3470 from overleaf/eslint
Upgrade and configure ESLint GitOrigin-RevId: ad5aeaf85e72c847a125ff3a9db99a12855e38aa
This commit is contained in:
@@ -19,9 +19,11 @@ describe('BetaProgram', function() {
|
||||
expect(response.statusCode).to.equal(302)
|
||||
response.statusCode.should.equal(302)
|
||||
expect(response.headers.location).to.equal('/beta/participate')
|
||||
const user = (await UserHelper.getUser({
|
||||
email
|
||||
})).user
|
||||
const user = (
|
||||
await UserHelper.getUser({
|
||||
email
|
||||
})
|
||||
).user
|
||||
expect(user.betaProgram).to.equal(true)
|
||||
})
|
||||
it('should opt out', async function() {
|
||||
@@ -31,9 +33,11 @@ describe('BetaProgram', function() {
|
||||
expect(response.statusCode).to.equal(302)
|
||||
response.statusCode.should.equal(302)
|
||||
expect(response.headers.location).to.equal('/beta/participate')
|
||||
const user = (await UserHelper.getUser({
|
||||
email
|
||||
})).user
|
||||
const user = (
|
||||
await UserHelper.getUser({
|
||||
email
|
||||
})
|
||||
).user
|
||||
expect(user.betaProgram).to.equal(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -25,9 +25,11 @@ describe('PasswordReset', function() {
|
||||
}
|
||||
})
|
||||
|
||||
token = (await db.tokens.findOne({
|
||||
'data.user_id': user._id.toString()
|
||||
})).token
|
||||
token = (
|
||||
await db.tokens.findOne({
|
||||
'data.user_id': user._id.toString()
|
||||
})
|
||||
).token
|
||||
})
|
||||
describe('with a valid token', function() {
|
||||
describe('when logged in', function() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
mocha/no-identical-title,
|
||||
no-path-concat,
|
||||
@@ -334,9 +334,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/doc/${
|
||||
this.refBibDoc._id
|
||||
}/rename`,
|
||||
uri: `/project/${this.example_project_id}/doc/${this.refBibDoc._id}/rename`,
|
||||
json: {
|
||||
name: 'main.tex'
|
||||
}
|
||||
@@ -357,9 +355,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/folder/${
|
||||
this.testFolderId
|
||||
}/rename`,
|
||||
uri: `/project/${this.example_project_id}/folder/${this.testFolderId}/rename`,
|
||||
json: {
|
||||
name: 'main.tex'
|
||||
}
|
||||
@@ -380,9 +376,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/file/${
|
||||
this.imageFile._id
|
||||
}/rename`,
|
||||
uri: `/project/${this.example_project_id}/file/${this.imageFile._id}/rename`,
|
||||
json: {
|
||||
name: 'main.tex'
|
||||
}
|
||||
@@ -405,9 +399,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/doc/${
|
||||
this.refBibDoc._id
|
||||
}/rename`,
|
||||
uri: `/project/${this.example_project_id}/doc/${this.refBibDoc._id}/rename`,
|
||||
json: {
|
||||
name: 'universe.jpg'
|
||||
}
|
||||
@@ -428,9 +420,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/folder/${
|
||||
this.testFolderId
|
||||
}/rename`,
|
||||
uri: `/project/${this.example_project_id}/folder/${this.testFolderId}/rename`,
|
||||
json: {
|
||||
name: 'universe.jpg'
|
||||
}
|
||||
@@ -451,9 +441,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/file/${
|
||||
this.imageFile._id
|
||||
}/rename`,
|
||||
uri: `/project/${this.example_project_id}/file/${this.imageFile._id}/rename`,
|
||||
json: {
|
||||
name: 'universe.jpg'
|
||||
}
|
||||
@@ -476,9 +464,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/doc/${
|
||||
this.refBibDoc._id
|
||||
}/rename`,
|
||||
uri: `/project/${this.example_project_id}/doc/${this.refBibDoc._id}/rename`,
|
||||
json: {
|
||||
name: 'testfolder'
|
||||
}
|
||||
@@ -499,9 +485,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/folder/${
|
||||
this.testFolderId
|
||||
}/rename`,
|
||||
uri: `/project/${this.example_project_id}/folder/${this.testFolderId}/rename`,
|
||||
json: {
|
||||
name: 'testfolder'
|
||||
}
|
||||
@@ -522,9 +506,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/file/${
|
||||
this.imageFile._id
|
||||
}/rename`,
|
||||
uri: `/project/${this.example_project_id}/file/${this.imageFile._id}/rename`,
|
||||
json: {
|
||||
name: 'testfolder'
|
||||
}
|
||||
@@ -597,9 +579,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/doc/${
|
||||
this.mainTexDoc._id
|
||||
}/move`,
|
||||
uri: `/project/${this.example_project_id}/doc/${this.mainTexDoc._id}/move`,
|
||||
json: {
|
||||
folder_id: this.testFolderId
|
||||
}
|
||||
@@ -620,9 +600,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/file/${
|
||||
this.imageFile._id
|
||||
}/move`,
|
||||
uri: `/project/${this.example_project_id}/file/${this.imageFile._id}/move`,
|
||||
json: {
|
||||
folder_id: this.testFolderId
|
||||
}
|
||||
@@ -643,9 +621,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/folder/${
|
||||
this.otherFolderId
|
||||
}/move`,
|
||||
uri: `/project/${this.example_project_id}/folder/${this.otherFolderId}/move`,
|
||||
json: {
|
||||
folder_id: this.testFolderId
|
||||
}
|
||||
@@ -666,9 +642,7 @@ describe('ProjectDuplicateNames', function() {
|
||||
beforeEach(function(done) {
|
||||
return this.owner.request.post(
|
||||
{
|
||||
uri: `/project/${this.example_project_id}/folder/${
|
||||
this.testFolderId
|
||||
}/move`,
|
||||
uri: `/project/${this.example_project_id}/folder/${this.testFolderId}/move`,
|
||||
json: {
|
||||
folder_id: this.subFolderId
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
*/
|
||||
// TODO: This file was created by bulk-decaffeinate.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
*/
|
||||
// TODO: This file was created by bulk-decaffeinate.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
*/
|
||||
// TODO: This file was created by bulk-decaffeinate.
|
||||
// Fix any style issues and re-enable lint.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
*/
|
||||
// TODO: This file was created by bulk-decaffeinate.
|
||||
|
||||
@@ -852,10 +852,12 @@ describe('UserEmails', function() {
|
||||
uri: '/user/emails'
|
||||
})
|
||||
expect(response.statusCode).to.equal(204)
|
||||
const token = (await db.tokens.findOne({
|
||||
'data.user_id': userId.toString(),
|
||||
'data.email': otherEmail
|
||||
})).token
|
||||
const token = (
|
||||
await db.tokens.findOne({
|
||||
'data.user_id': userId.toString(),
|
||||
'data.email': otherEmail
|
||||
})
|
||||
).token
|
||||
response = await userHelper.request.post(`/user/emails/confirm`, {
|
||||
form: {
|
||||
token
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-unused-vars,
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-unused-vars,
|
||||
*/
|
||||
|
||||
@@ -24,17 +24,13 @@ module.exports = MockClsiApi = {
|
||||
error: null,
|
||||
outputFiles: [
|
||||
{
|
||||
url: `/project/${
|
||||
req.params.project_id
|
||||
}/build/1234/output/project.pdf`,
|
||||
url: `/project/${req.params.project_id}/build/1234/output/project.pdf`,
|
||||
path: 'project.pdf',
|
||||
type: 'pdf',
|
||||
build: 1234
|
||||
},
|
||||
{
|
||||
url: `/project/${
|
||||
req.params.project_id
|
||||
}/build/1234/output/project.log`,
|
||||
url: `/project/${req.params.project_id}/build/1234/output/project.log`,
|
||||
path: 'project.log',
|
||||
type: 'log',
|
||||
build: 1234
|
||||
|
||||
@@ -54,12 +54,8 @@ module.exports = MockRecurlyApi = {
|
||||
<state>${subscription.state}</state>
|
||||
<tax_in_cents type="integer">${subscription.tax_in_cents}</tax_in_cents>
|
||||
<tax_rate type="float">${subscription.tax_rate}</tax_rate>
|
||||
<current_period_ends_at type="datetime">${
|
||||
subscription.current_period_ends_at
|
||||
}</current_period_ends_at>
|
||||
<unit_amount_in_cents type="integer">${
|
||||
subscription.unit_amount_in_cents
|
||||
}</unit_amount_in_cents>
|
||||
<current_period_ends_at type="datetime">${subscription.current_period_ends_at}</current_period_ends_at>
|
||||
<unit_amount_in_cents type="integer">${subscription.unit_amount_in_cents}</unit_amount_in_cents>
|
||||
<account href="accounts/${subscription.account.id}" />
|
||||
<trial_ends_at type="datetime">${subscription.trial_ends_at}</trial_ends_at>
|
||||
</subscription>\
|
||||
@@ -75,9 +71,7 @@ module.exports = MockRecurlyApi = {
|
||||
return res.send(`\
|
||||
<account>
|
||||
<account_code>${req.params.id}</account_code>
|
||||
<hosted_login_token>${
|
||||
subscription.account.hosted_login_token
|
||||
}</hosted_login_token>
|
||||
<hosted_login_token>${subscription.account.hosted_login_token}</hosted_login_token>
|
||||
<email>${subscription.account.email}</email>
|
||||
</account>\
|
||||
`)
|
||||
|
||||
@@ -34,9 +34,7 @@ module.exports = MockV1HistoryApi = {
|
||||
res.header('content-disposition', 'attachment; name=project.zip')
|
||||
res.header('content-type', 'application/octet-stream')
|
||||
return res.send(
|
||||
`Mock zip for ${req.params.project_id} at version ${
|
||||
req.params.version
|
||||
}`
|
||||
`Mock zip for ${req.params.project_id} at version ${req.params.version}`
|
||||
)
|
||||
}
|
||||
)
|
||||
@@ -51,9 +49,7 @@ module.exports = MockV1HistoryApi = {
|
||||
res.header('content-type', 'application/octet-stream')
|
||||
if (req.params.version === '42') {
|
||||
return res.send(
|
||||
`Mock zip for ${req.params.project_id} at version ${
|
||||
req.params.version
|
||||
}`
|
||||
`Mock zip for ${req.params.project_id} at version ${req.params.version}`
|
||||
)
|
||||
}
|
||||
function writeChunk() {
|
||||
@@ -86,9 +82,7 @@ module.exports = MockV1HistoryApi = {
|
||||
MockV1HistoryApi.requestedZipPacks++
|
||||
MockV1HistoryApi.events.emit('v1-history-pack-zip')
|
||||
return res.json({
|
||||
zipUrl: `http://localhost:3100/fake-zip-download/${
|
||||
req.params.project_id
|
||||
}/version/${req.params.version}`
|
||||
zipUrl: `http://localhost:3100/fake-zip-download/${req.params.project_id}/version/${req.params.version}`
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
@@ -585,9 +585,7 @@ class User {
|
||||
} else {
|
||||
callback(
|
||||
new Error(
|
||||
`unexpected status code from /user/personal_info: ${
|
||||
response.statusCode
|
||||
}`
|
||||
`unexpected status code from /user/personal_info: ${response.statusCode}`
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-unused-vars,
|
||||
*/
|
||||
|
||||
+4
-1
@@ -35,7 +35,10 @@ describe('<FileTreeFolderList/>', function() {
|
||||
|
||||
describe('selection and multi-selection', function() {
|
||||
it('without write permissions', function() {
|
||||
const docs = [{ _id: '1', name: '1.tex' }, { _id: '2', name: '2.tex' }]
|
||||
const docs = [
|
||||
{ _id: '1', name: '1.tex' },
|
||||
{ _id: '2', name: '2.tex' }
|
||||
]
|
||||
renderWithContext(
|
||||
<FileTreeFolderList folders={[]} docs={docs} files={[]} />,
|
||||
{ contextProps: { hasWritePermissions: false } }
|
||||
|
||||
@@ -91,9 +91,7 @@ entering extended mode
|
||||
it('renders a link to location button for every error and warning log entry', function() {
|
||||
logEntries.all.forEach((entry, index) => {
|
||||
const linkToSourceButton = screen.getByRole('button', {
|
||||
name: `Navigate to log position in source code: ${entry.file}, ${
|
||||
entry.line
|
||||
}`
|
||||
name: `Navigate to log position in source code: ${entry.file}, ${entry.line}`
|
||||
})
|
||||
fireEvent.click(linkToSourceButton)
|
||||
expect(onLogEntryLocationClick).to.have.callCount(index + 1)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -67,9 +67,7 @@ describe('ChatApiHandler', function() {
|
||||
it('should post the data to the chat api', function() {
|
||||
return this.request
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.chat.internal_url}/project/${
|
||||
this.project_id
|
||||
}/messages`,
|
||||
url: `${this.settings.apis.chat.internal_url}/project/${this.project_id}/messages`,
|
||||
method: 'POST',
|
||||
json: {
|
||||
content: this.content,
|
||||
@@ -125,9 +123,7 @@ describe('ChatApiHandler', function() {
|
||||
return this.request
|
||||
.calledWith({
|
||||
method: 'GET',
|
||||
url: `${this.settings.apis.chat.internal_url}/project/${
|
||||
this.project_id
|
||||
}/messages`,
|
||||
url: `${this.settings.apis.chat.internal_url}/project/${this.project_id}/messages`,
|
||||
qs: {
|
||||
limit: this.limit,
|
||||
before: this.before
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
chai-friendly/no-unused-expressions,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
@@ -37,6 +37,7 @@ describe('CollaboratorsInviteHandler', function() {
|
||||
this.deleteOne = sinon.stub()
|
||||
this.countDocuments = sinon.stub()
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
if (options == null) {
|
||||
options = {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
@@ -49,9 +49,7 @@ describe('ClsiFormatChecker', function() {
|
||||
},
|
||||
{
|
||||
path: 'stuff/image/image.png',
|
||||
url: `http:somewhere.com/project/${
|
||||
this.project_id
|
||||
}/file/1234124321312`,
|
||||
url: `http:somewhere.com/project/${this.project_id}/file/1234124321312`,
|
||||
modified: 'more stuff'
|
||||
}
|
||||
])
|
||||
|
||||
@@ -93,17 +93,13 @@ describe('ClsiManager', function() {
|
||||
status: (this.status = 'success'),
|
||||
outputFiles: [
|
||||
{
|
||||
url: `${this.settings.apis.clsi.url}/project/${
|
||||
this.project_id
|
||||
}/user/${this.user_id}/build/1234/output/output.pdf`,
|
||||
url: `${this.settings.apis.clsi.url}/project/${this.project_id}/user/${this.user_id}/build/1234/output/output.pdf`,
|
||||
path: 'output.pdf',
|
||||
type: 'pdf',
|
||||
build: 1234
|
||||
},
|
||||
{
|
||||
url: `${this.settings.apis.clsi.url}/project/${
|
||||
this.project_id
|
||||
}/user/${this.user_id}/build/1234/output/output.log`,
|
||||
url: `${this.settings.apis.clsi.url}/project/${this.project_id}/user/${this.user_id}/build/1234/output/output.log`,
|
||||
path: 'output.log',
|
||||
type: 'log',
|
||||
build: 1234
|
||||
@@ -134,17 +130,13 @@ describe('ClsiManager', function() {
|
||||
it('should call the callback with the status and output files', function() {
|
||||
const outputFiles = [
|
||||
{
|
||||
url: `/project/${this.project_id}/user/${
|
||||
this.user_id
|
||||
}/build/1234/output/output.pdf`,
|
||||
url: `/project/${this.project_id}/user/${this.user_id}/build/1234/output/output.pdf`,
|
||||
path: 'output.pdf',
|
||||
type: 'pdf',
|
||||
build: 1234
|
||||
},
|
||||
{
|
||||
url: `/project/${this.project_id}/user/${
|
||||
this.user_id
|
||||
}/build/1234/output/output.log`,
|
||||
url: `/project/${this.project_id}/user/${this.user_id}/build/1234/output/output.log`,
|
||||
path: 'output.log',
|
||||
type: 'log',
|
||||
build: 1234
|
||||
@@ -300,17 +292,13 @@ describe('ClsiManager', function() {
|
||||
status: (this.status = 'success'),
|
||||
outputFiles: [
|
||||
{
|
||||
url: `${this.settings.apis.clsi.url}/project/${
|
||||
this.submission_id
|
||||
}/build/1234/output/output.pdf`,
|
||||
url: `${this.settings.apis.clsi.url}/project/${this.submission_id}/build/1234/output/output.pdf`,
|
||||
path: 'output.pdf',
|
||||
type: 'pdf',
|
||||
build: 1234
|
||||
},
|
||||
{
|
||||
url: `${this.settings.apis.clsi.url}/project/${
|
||||
this.submission_id
|
||||
}/build/1234/output/output.log`,
|
||||
url: `${this.settings.apis.clsi.url}/project/${this.submission_id}/build/1234/output/output.log`,
|
||||
path: 'output.log',
|
||||
type: 'log',
|
||||
build: 1234
|
||||
@@ -421,9 +409,7 @@ describe('ClsiManager', function() {
|
||||
this.ClsiManager._makeRequest
|
||||
.calledWith(this.project_id, {
|
||||
method: 'DELETE',
|
||||
url: `${this.settings.apis.clsi.url}/project/${
|
||||
this.project_id
|
||||
}/user/${this.user_id}`
|
||||
url: `${this.settings.apis.clsi.url}/project/${this.project_id}/user/${this.user_id}`
|
||||
})
|
||||
.should.equal(true)
|
||||
})
|
||||
@@ -554,9 +540,7 @@ describe('ClsiManager', function() {
|
||||
},
|
||||
{
|
||||
path: 'images/image.png',
|
||||
url: `${this.settings.apis.filestore.url}/project/${
|
||||
this.project_id
|
||||
}/file/${this.file_1._id}`,
|
||||
url: `${this.settings.apis.filestore.url}/project/${this.project_id}/file/${this.file_1._id}`,
|
||||
modified: this.file_1.created.getTime()
|
||||
}
|
||||
]
|
||||
@@ -862,9 +846,7 @@ describe('ClsiManager', function() {
|
||||
})
|
||||
|
||||
it('should send the request to the CLSI', function() {
|
||||
const url = `${this.settings.apis.clsi.url}/project/${
|
||||
this.project_id
|
||||
}/user/${this.user_id}/compile`
|
||||
const url = `${this.settings.apis.clsi.url}/project/${this.project_id}/user/${this.user_id}/compile`
|
||||
this.ClsiManager._makeRequest
|
||||
.calledWith(this.project_id, {
|
||||
method: 'POST',
|
||||
@@ -938,9 +920,7 @@ describe('ClsiManager', function() {
|
||||
this.ClsiManager._makeRequest
|
||||
.calledWith(this.project_id, {
|
||||
method: 'GET',
|
||||
url: `http://clsi.example.com/project/${this.project_id}/user/${
|
||||
this.user_id
|
||||
}/wordcount`,
|
||||
url: `http://clsi.example.com/project/${this.project_id}/user/${this.user_id}/wordcount`,
|
||||
qs: { file: 'rootfile.text', image: undefined }
|
||||
})
|
||||
.should.equal(true)
|
||||
@@ -966,9 +946,7 @@ describe('ClsiManager', function() {
|
||||
this.ClsiManager._makeRequest
|
||||
.calledWith(this.project_id, {
|
||||
method: 'GET',
|
||||
url: `http://clsi.example.com/project/${this.project_id}/user/${
|
||||
this.user_id
|
||||
}/wordcount`,
|
||||
url: `http://clsi.example.com/project/${this.project_id}/user/${this.user_id}/wordcount`,
|
||||
qs: { file: 'main.tex', image: undefined }
|
||||
})
|
||||
.should.equal(true)
|
||||
@@ -992,9 +970,7 @@ describe('ClsiManager', function() {
|
||||
this.ClsiManager._makeRequest
|
||||
.calledWith(this.project_id, {
|
||||
method: 'GET',
|
||||
url: `http://clsi.example.com/project/${this.project_id}/user/${
|
||||
this.user_id
|
||||
}/wordcount`,
|
||||
url: `http://clsi.example.com/project/${this.project_id}/user/${this.user_id}/wordcount`,
|
||||
qs: { file: 'main.tex', image: this.image }
|
||||
})
|
||||
.should.equal(true)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -308,9 +308,7 @@ describe('CompileController', function() {
|
||||
return this.CompileController.proxyToClsi
|
||||
.calledWith(
|
||||
this.project_id,
|
||||
`/project/${this.project_id}/user/${
|
||||
this.user_id
|
||||
}/output/output.pdf`,
|
||||
`/project/${this.project_id}/user/${this.user_id}/output/output.pdf`,
|
||||
this.req,
|
||||
this.res,
|
||||
this.next
|
||||
@@ -331,9 +329,7 @@ describe('CompileController', function() {
|
||||
return this.CompileController.proxyToClsi
|
||||
.calledWith(
|
||||
this.project_id,
|
||||
`/project/${this.project_id}/user/${this.user_id}/build/${
|
||||
this.buildId
|
||||
}/output/output.pdf`,
|
||||
`/project/${this.project_id}/user/${this.user_id}/build/${this.buildId}/output/output.pdf`,
|
||||
this.req,
|
||||
this.res,
|
||||
this.next
|
||||
@@ -376,9 +372,7 @@ describe('CompileController', function() {
|
||||
file: this.file
|
||||
}
|
||||
this.req.body = {}
|
||||
this.expected_url = `/project/${this.submission_id}/build/${
|
||||
this.build_id
|
||||
}/output/${this.file}`
|
||||
this.expected_url = `/project/${this.submission_id}/build/${this.build_id}/output/${this.file}`
|
||||
return (this.CompileController.proxyToClsiWithLimits = sinon.stub())
|
||||
})
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -59,9 +59,7 @@ describe('ContactManager', function() {
|
||||
it('should get the contacts from the contacts api', function() {
|
||||
return this.request.get
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.contacts.url}/user/${
|
||||
this.user_id
|
||||
}/contacts`,
|
||||
url: `${this.settings.apis.contacts.url}/user/${this.user_id}/contacts`,
|
||||
qs: { limit: 42 },
|
||||
json: true,
|
||||
jar: false
|
||||
@@ -121,9 +119,7 @@ describe('ContactManager', function() {
|
||||
it('should add the contacts for the user in the contacts api', function() {
|
||||
return this.request.post
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.contacts.url}/user/${
|
||||
this.user_id
|
||||
}/contacts`,
|
||||
url: `${this.settings.apis.contacts.url}/user/${this.user_id}/contacts`,
|
||||
json: {
|
||||
contact_id: this.contact_id
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
*/
|
||||
|
||||
@@ -66,9 +66,7 @@ describe('DocstoreManager', function() {
|
||||
it('should delete the doc in the docstore api', function() {
|
||||
return this.request.del
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.docstore.url}/project/${
|
||||
this.project_id
|
||||
}/doc/${this.doc_id}`,
|
||||
url: `${this.settings.apis.docstore.url}/project/${this.project_id}/doc/${this.doc_id}`,
|
||||
timeout: 30 * 1000
|
||||
})
|
||||
.should.equal(true)
|
||||
@@ -168,9 +166,7 @@ describe('DocstoreManager', function() {
|
||||
it('should update the doc in the docstore api', function() {
|
||||
return this.request.post
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.docstore.url}/project/${
|
||||
this.project_id
|
||||
}/doc/${this.doc_id}`,
|
||||
url: `${this.settings.apis.docstore.url}/project/${this.project_id}/doc/${this.doc_id}`,
|
||||
timeout: 30 * 1000,
|
||||
json: {
|
||||
lines: this.lines,
|
||||
@@ -245,9 +241,7 @@ describe('DocstoreManager', function() {
|
||||
it('should get the doc from the docstore api', function() {
|
||||
return this.request.get
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.docstore.url}/project/${
|
||||
this.project_id
|
||||
}/doc/${this.doc_id}`,
|
||||
url: `${this.settings.apis.docstore.url}/project/${this.project_id}/doc/${this.doc_id}`,
|
||||
timeout: 30 * 1000,
|
||||
json: true
|
||||
})
|
||||
@@ -305,9 +299,7 @@ describe('DocstoreManager', function() {
|
||||
it('should get the doc from the docstore api (including deleted)', function() {
|
||||
return this.request.get
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.docstore.url}/project/${
|
||||
this.project_id
|
||||
}/doc/${this.doc_id}?include_deleted=true`,
|
||||
url: `${this.settings.apis.docstore.url}/project/${this.project_id}/doc/${this.doc_id}?include_deleted=true`,
|
||||
timeout: 30 * 1000,
|
||||
json: true
|
||||
})
|
||||
@@ -362,9 +354,7 @@ describe('DocstoreManager', function() {
|
||||
it('should get all the project docs in the docstore api', function() {
|
||||
return this.request.get
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.docstore.url}/project/${
|
||||
this.project_id
|
||||
}/doc`,
|
||||
url: `${this.settings.apis.docstore.url}/project/${this.project_id}/doc`,
|
||||
timeout: 30 * 1000,
|
||||
json: true
|
||||
})
|
||||
@@ -418,9 +408,7 @@ describe('DocstoreManager', function() {
|
||||
it('should get all the project doc ranges in the docstore api', function() {
|
||||
return this.request.get
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.docstore.url}/project/${
|
||||
this.project_id
|
||||
}/ranges`,
|
||||
url: `${this.settings.apis.docstore.url}/project/${this.project_id}/ranges`,
|
||||
timeout: 30 * 1000,
|
||||
json: true
|
||||
})
|
||||
|
||||
@@ -67,9 +67,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
it('should flush the document from the document updater', function() {
|
||||
this.request
|
||||
.calledWithMatch({
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}/flush`,
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${this.project_id}/flush`,
|
||||
method: 'POST'
|
||||
})
|
||||
.should.equal(true)
|
||||
@@ -134,9 +132,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
it('should delete the project from the document updater', function() {
|
||||
this.request
|
||||
.calledWithMatch({
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}`,
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${this.project_id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
.should.equal(true)
|
||||
@@ -208,9 +204,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
it('should flush the document from the document updater', function() {
|
||||
this.request
|
||||
.calledWithMatch({
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}/doc/${this.doc_id}/flush`,
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${this.project_id}/doc/${this.doc_id}/flush`,
|
||||
method: 'POST'
|
||||
})
|
||||
.should.equal(true)
|
||||
@@ -280,9 +274,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
it('should delete the document from the document updater', function() {
|
||||
this.request
|
||||
.calledWithMatch({
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}/doc/${this.doc_id}`,
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${this.project_id}/doc/${this.doc_id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
.should.equal(true)
|
||||
@@ -355,9 +347,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
it('should set the document in the document updater', function() {
|
||||
this.request
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}/doc/${this.doc_id}`,
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${this.project_id}/doc/${this.doc_id}`,
|
||||
json: {
|
||||
lines: this.lines,
|
||||
source: this.source,
|
||||
@@ -450,9 +440,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
it('should get the document from the document updater', function() {
|
||||
this.request
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}/doc/${this.doc_id}?fromVersion=${this.fromVersion}`,
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${this.project_id}/doc/${this.doc_id}?fromVersion=${this.fromVersion}`,
|
||||
method: 'GET',
|
||||
json: true
|
||||
})
|
||||
@@ -542,9 +530,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
})
|
||||
|
||||
it('should get the documents from the document updater', function() {
|
||||
const url = `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}/get_and_flush_if_old?state=${this.project_state_hash}`
|
||||
const url = `${this.settings.apis.documentupdater.url}/project/${this.project_id}/get_and_flush_if_old?state=${this.project_state_hash}`
|
||||
this.request.post.calledWith(url).should.equal(true)
|
||||
})
|
||||
|
||||
@@ -600,9 +586,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
it('should clear the project state from the document updater', function() {
|
||||
this.request
|
||||
.calledWithMatch({
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}/clearState`,
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${this.project_id}/clearState`,
|
||||
method: 'POST'
|
||||
})
|
||||
.should.equal(true)
|
||||
@@ -673,9 +657,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
it('should accept the change in the document updater', function() {
|
||||
this.request
|
||||
.calledWith({
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}/doc/${this.doc_id}/change/accept`,
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${this.project_id}/doc/${this.doc_id}/change/accept`,
|
||||
json: {
|
||||
change_ids: [this.change_id]
|
||||
},
|
||||
@@ -759,9 +741,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
it('should delete the thread in the document updater', function() {
|
||||
this.request
|
||||
.calledWithMatch({
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}/doc/${this.doc_id}/comment/${this.thread_id}`,
|
||||
url: `${this.settings.apis.documentupdater.url}/project/${this.project_id}/doc/${this.doc_id}/comment/${this.thread_id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
.should.equal(true)
|
||||
@@ -853,9 +833,7 @@ describe('DocumentUpdaterHandler', function() {
|
||||
describe('with project history enabled', function() {
|
||||
beforeEach(function() {
|
||||
this.settings.apis.project_history.sendProjectStructureOps = true
|
||||
this.url = `${this.settings.apis.documentupdater.url}/project/${
|
||||
this.project_id
|
||||
}`
|
||||
this.url = `${this.settings.apis.documentupdater.url}/project/${this.project_id}`
|
||||
this.request.callsArgWith(1, null, { statusCode: 204 }, '')
|
||||
})
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -193,9 +193,7 @@ describe('EmailBuilder', function() {
|
||||
this.userId = 'abc123'
|
||||
this.opts = {
|
||||
to: this.emailAddress,
|
||||
confirmEmailUrl: `${
|
||||
this.settings.siteUrl
|
||||
}/user/emails/confirm?token=aToken123`,
|
||||
confirmEmailUrl: `${this.settings.siteUrl}/user/emails/confirm?token=aToken123`,
|
||||
sendingUser_id: this.userId
|
||||
}
|
||||
this.email = this.EmailBuilder.buildEmail('confirmEmail', this.opts)
|
||||
@@ -320,9 +318,7 @@ describe('EmailBuilder', function() {
|
||||
this.emailAddress = 'example@overleaf.com'
|
||||
this.opts = {
|
||||
to: this.emailAddress,
|
||||
acceptInviteUrl: `${
|
||||
this.settings.siteUrl
|
||||
}/subscription/invites/aToken123/`,
|
||||
acceptInviteUrl: `${this.settings.siteUrl}/subscription/invites/aToken123/`,
|
||||
inviter: {
|
||||
email: 'deanna@overleaf.com',
|
||||
first_name: 'Deanna',
|
||||
@@ -441,9 +437,7 @@ describe('EmailBuilder', function() {
|
||||
this.emailAddress = 'example@overleaf.com'
|
||||
this.opts = {
|
||||
to: this.emailAddress,
|
||||
setNewPasswordUrl: `${
|
||||
this.settings.siteUrl
|
||||
}/user/activate?token=aToken123&user_id=aUserId123`
|
||||
setNewPasswordUrl: `${this.settings.siteUrl}/user/activate?token=aToken123&user_id=aUserId123`
|
||||
}
|
||||
this.email = this.EmailBuilder.buildEmail('registered', this.opts)
|
||||
})
|
||||
@@ -485,9 +479,7 @@ describe('EmailBuilder', function() {
|
||||
this.projectName = 'Top Secret'
|
||||
this.opts = {
|
||||
inviteUrl:
|
||||
`${
|
||||
this.settings.siteUrl
|
||||
}/project/projectId123/invite/token/aToken123?` +
|
||||
`${this.settings.siteUrl}/project/projectId123/invite/token/aToken123?` +
|
||||
[
|
||||
`project_name=${encodeURIComponent(this.projectName)}`,
|
||||
`user_first_name=${encodeURIComponent(this.owner.name)}`
|
||||
@@ -532,18 +524,12 @@ describe('EmailBuilder', function() {
|
||||
describe('securityAlert', function() {
|
||||
before(function() {
|
||||
this.message = 'more details about the action'
|
||||
this.messageHTML = `<br /><span style="text-align:center" class="a-class"><b><i>${
|
||||
this.message
|
||||
}</i></b></span>`
|
||||
this.messageHTML = `<br /><span style="text-align:center" class="a-class"><b><i>${this.message}</i></b></span>`
|
||||
this.messageNotAllowedHTML = `<div></div>${this.messageHTML}`
|
||||
|
||||
this.actionDescribed = 'an action described'
|
||||
this.actionDescribedHTML = `<br /><span style="text-align:center" class="a-class"><b><i>${
|
||||
this.actionDescribed
|
||||
}</i></b>`
|
||||
this.actionDescribedNotAllowedHTML = `<div></div>${
|
||||
this.actionDescribedHTML
|
||||
}`
|
||||
this.actionDescribedHTML = `<br /><span style="text-align:center" class="a-class"><b><i>${this.actionDescribed}</i></b>`
|
||||
this.actionDescribedNotAllowedHTML = `<div></div>${this.actionDescribedHTML}`
|
||||
|
||||
this.opts = {
|
||||
to: this.email,
|
||||
|
||||
@@ -24,7 +24,6 @@ describe('FileStoreHandler', function() {
|
||||
my: 'writeStream',
|
||||
on(type, cb) {
|
||||
if (type === 'response') {
|
||||
// eslint-disable-next-line standard/no-callback-literal
|
||||
cb({ statusCode: 200 })
|
||||
}
|
||||
}
|
||||
@@ -213,7 +212,6 @@ describe('FileStoreHandler', function() {
|
||||
beforeEach(function() {
|
||||
this.writeStream.on = function(type, cb) {
|
||||
if (type === 'response') {
|
||||
// eslint-disable-next-line standard/no-callback-literal
|
||||
cb({ statusCode: 500 })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -70,9 +70,7 @@ describe('InstitutionsAPI', function() {
|
||||
should.not.exist(err)
|
||||
this.request.calledOnce.should.equal(true)
|
||||
const requestOptions = this.request.lastCall.args[0]
|
||||
const expectedUrl = `v1.url/api/v2/institutions/${
|
||||
this.institutionId
|
||||
}/affiliations`
|
||||
const expectedUrl = `v1.url/api/v2/institutions/${this.institutionId}/affiliations`
|
||||
requestOptions.url.should.equal(expectedUrl)
|
||||
requestOptions.method.should.equal('GET')
|
||||
should.not.exist(requestOptions.body)
|
||||
@@ -116,9 +114,7 @@ describe('InstitutionsAPI', function() {
|
||||
should.not.exist(err)
|
||||
this.request.calledOnce.should.equal(true)
|
||||
const requestOptions = this.request.lastCall.args[0]
|
||||
const expectedUrl = `v1.url/api/v2/institutions/${
|
||||
this.institutionId
|
||||
}/institution_licences`
|
||||
const expectedUrl = `v1.url/api/v2/institutions/${this.institutionId}/institution_licences`
|
||||
requestOptions.url.should.equal(expectedUrl)
|
||||
requestOptions.method.should.equal('GET')
|
||||
requestOptions.body['start_date'].should.equal(startDate)
|
||||
@@ -141,9 +137,7 @@ describe('InstitutionsAPI', function() {
|
||||
should.not.exist(err)
|
||||
this.request.calledOnce.should.equal(true)
|
||||
const requestOptions = this.request.lastCall.args[0]
|
||||
const expectedUrl = `v1.url/api/v2/users/${
|
||||
this.stubbedUser._id
|
||||
}/affiliations`
|
||||
const expectedUrl = `v1.url/api/v2/users/${this.stubbedUser._id}/affiliations`
|
||||
requestOptions.url.should.equal(expectedUrl)
|
||||
requestOptions.method.should.equal('GET')
|
||||
should.not.exist(requestOptions.body)
|
||||
@@ -200,9 +194,7 @@ describe('InstitutionsAPI', function() {
|
||||
should.not.exist(err)
|
||||
this.request.calledOnce.should.equal(true)
|
||||
const requestOptions = this.request.lastCall.args[0]
|
||||
const expectedUrl = `v1.url/api/v2/users/${
|
||||
this.stubbedUser._id
|
||||
}/affiliations`
|
||||
const expectedUrl = `v1.url/api/v2/users/${this.stubbedUser._id}/affiliations`
|
||||
requestOptions.url.should.equal(expectedUrl)
|
||||
requestOptions.method.should.equal('POST')
|
||||
|
||||
@@ -250,9 +242,7 @@ describe('InstitutionsAPI', function() {
|
||||
should.not.exist(err)
|
||||
this.request.calledOnce.should.equal(true)
|
||||
const requestOptions = this.request.lastCall.args[0]
|
||||
const expectedUrl = `v1.url/api/v2/users/${
|
||||
this.stubbedUser._id
|
||||
}/affiliations/remove`
|
||||
const expectedUrl = `v1.url/api/v2/users/${this.stubbedUser._id}/affiliations/remove`
|
||||
requestOptions.url.should.equal(expectedUrl)
|
||||
requestOptions.method.should.equal('POST')
|
||||
expect(requestOptions.body).to.deep.equal({ email: this.newEmail })
|
||||
@@ -284,9 +274,7 @@ describe('InstitutionsAPI', function() {
|
||||
should.not.exist(err)
|
||||
this.request.calledOnce.should.equal(true)
|
||||
const requestOptions = this.request.lastCall.args[0]
|
||||
const expectedUrl = `v1.url/api/v2/users/${
|
||||
this.stubbedUser._id
|
||||
}/affiliations`
|
||||
const expectedUrl = `v1.url/api/v2/users/${this.stubbedUser._id}/affiliations`
|
||||
requestOptions.url.should.equal(expectedUrl)
|
||||
requestOptions.method.should.equal('DELETE')
|
||||
return done()
|
||||
@@ -322,9 +310,7 @@ describe('InstitutionsAPI', function() {
|
||||
should.not.exist(err)
|
||||
this.request.calledOnce.should.equal(true)
|
||||
const requestOptions = this.request.lastCall.args[0]
|
||||
const expectedUrl = `v1.url/api/v2/users/${
|
||||
this.stubbedUser._id
|
||||
}/affiliations/endorse`
|
||||
const expectedUrl = `v1.url/api/v2/users/${this.stubbedUser._id}/affiliations/endorse`
|
||||
requestOptions.url.should.equal(expectedUrl)
|
||||
requestOptions.method.should.equal('POST')
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -129,10 +129,9 @@ describe('ProjectDetailsHandler', function() {
|
||||
it('should make a call to mongo just for the description', async function() {
|
||||
this.ProjectGetter.promises.getProject.resolves()
|
||||
await this.handler.promises.getProjectDescription(this.project._id)
|
||||
expect(this.ProjectGetter.promises.getProject).to.have.been.calledWith(
|
||||
this.project._id,
|
||||
{ description: true }
|
||||
)
|
||||
expect(
|
||||
this.ProjectGetter.promises.getProject
|
||||
).to.have.been.calledWith(this.project._id, { description: true })
|
||||
})
|
||||
|
||||
it('should return what the mongo call returns', async function() {
|
||||
@@ -269,8 +268,14 @@ describe('ProjectDetailsHandler', function() {
|
||||
{ _id: 139, name: 'numeric (39)' },
|
||||
{ _id: 140, name: 'numeric (40)' }
|
||||
],
|
||||
readAndWrite: [{ _id: 4, name: 'name2' }, { _id: 5, name: 'name22' }],
|
||||
readOnly: [{ _id: 6, name: 'name3' }, { _id: 7, name: 'name33' }],
|
||||
readAndWrite: [
|
||||
{ _id: 4, name: 'name2' },
|
||||
{ _id: 5, name: 'name22' }
|
||||
],
|
||||
readOnly: [
|
||||
{ _id: 6, name: 'name3' },
|
||||
{ _id: 7, name: 'name33' }
|
||||
],
|
||||
tokenReadAndWrite: [
|
||||
{ _id: 8, name: 'name4' },
|
||||
{ _id: 9, name: 'name44' }
|
||||
|
||||
@@ -40,6 +40,7 @@ describe('ProjectEntityHandler', function() {
|
||||
static initClass() {
|
||||
this.prototype.rootFolder = [this.rootFolder]
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
this._id = project_id
|
||||
this.name = 'project_name_here'
|
||||
|
||||
@@ -31,6 +31,7 @@ describe('ProjectHistoryHandler', function() {
|
||||
static initClass() {
|
||||
this.prototype.rootFolder = [this.rootFolder]
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
this._id = project_id
|
||||
this.name = 'project_name_here'
|
||||
|
||||
@@ -373,9 +373,7 @@ describe('ProjectLocator', function() {
|
||||
})
|
||||
|
||||
it('should take a file path and return the element for a nested document', function(done) {
|
||||
const path = `${subFolder.name}/${secondSubFolder.name}/${
|
||||
subSubFile.name
|
||||
}`
|
||||
const path = `${subFolder.name}/${secondSubFolder.name}/${subSubFile.name}`
|
||||
this.locator.findElementByPath(
|
||||
{ project, path },
|
||||
(err, element, type) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -34,7 +34,7 @@ describe('ReferalFeatures', function() {
|
||||
beforeEach(function() {
|
||||
this.refered_user_count = 3
|
||||
this.Settings.bonus_features = {
|
||||
'3': {
|
||||
3: {
|
||||
collaborators: 3,
|
||||
dropbox: false,
|
||||
versioning: false
|
||||
@@ -64,7 +64,7 @@ describe('ReferalFeatures', function() {
|
||||
beforeEach(function() {
|
||||
this.refered_user_count = 0
|
||||
this.Settings.bonus_features = {
|
||||
'1': {
|
||||
1: {
|
||||
collaborators: 3,
|
||||
dropbox: false,
|
||||
versioning: false
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
mocha/no-identical-title,
|
||||
no-return-assign,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
standard/no-callback-literal,
|
||||
*/
|
||||
// TODO: This file was created by bulk-decaffeinate.
|
||||
// Fix any style issues and re-enable lint.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-dupe-keys,
|
||||
no-return-assign,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -160,9 +160,7 @@ describe('TeamInvitesHandler', function() {
|
||||
sinon.match({
|
||||
to: 'john.snow@example.com',
|
||||
inviter: this.manager,
|
||||
acceptInviteUrl: `http://example.com/subscription/invites/${
|
||||
this.newToken
|
||||
}/`
|
||||
acceptInviteUrl: `http://example.com/subscription/invites/${this.newToken}/`
|
||||
})
|
||||
)
|
||||
.should.equal(true)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
@@ -689,9 +689,7 @@ describe('TokenAccessHandler', function() {
|
||||
it('should return response body', function() {
|
||||
expect(
|
||||
this.V1Api.request.calledWith({
|
||||
url: `/api/v1/sharelatex/users/${this.v1UserId}/docs/${
|
||||
this.token
|
||||
}/info`
|
||||
url: `/api/v1/sharelatex/users/${this.v1UserId}/docs/${this.token}/info`
|
||||
})
|
||||
).to.equal(true)
|
||||
return expect(this.callback.calledWith(null, 'mock-data')).to.equal(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -592,9 +592,7 @@ describe('UserController', function() {
|
||||
this.EmailHandler.promises.sendEmail.callCount.should.equal(1)
|
||||
const expectedArg = {
|
||||
to: this.user.email,
|
||||
actionDescribed: `active sessions were cleared on your account ${
|
||||
this.user.email
|
||||
}`,
|
||||
actionDescribed: `active sessions were cleared on your account ${this.user.email}`,
|
||||
action: 'active sessions cleared'
|
||||
}
|
||||
const emailCall = this.EmailHandler.promises.sendEmail.lastCall
|
||||
@@ -706,9 +704,7 @@ describe('UserController', function() {
|
||||
this.res.json.callsFake(() => {
|
||||
const expectedArg = {
|
||||
to: this.user.email,
|
||||
actionDescribed: `your password has been changed on your account ${
|
||||
this.user.email
|
||||
}`,
|
||||
actionDescribed: `your password has been changed on your account ${this.user.email}`,
|
||||
action: 'password changed'
|
||||
}
|
||||
const emailCall = this.EmailHandler.sendEmail.lastCall
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
@@ -293,9 +293,7 @@ describe('UserRegistrationHandler', function() {
|
||||
return this.EmailHandler.sendEmail
|
||||
.calledWith('registered', {
|
||||
to: this.user.email,
|
||||
setNewPasswordUrl: `${this.settings.siteUrl}/user/activate?token=${
|
||||
this.token
|
||||
}&user_id=${this.user_id}`
|
||||
setNewPasswordUrl: `${this.settings.siteUrl}/user/activate?token=${this.token}&user_id=${this.user_id}`
|
||||
})
|
||||
.should.equal(true)
|
||||
})
|
||||
@@ -305,9 +303,7 @@ describe('UserRegistrationHandler', function() {
|
||||
.calledWith(
|
||||
null,
|
||||
this.user,
|
||||
`${this.settings.siteUrl}/user/activate?token=${
|
||||
this.token
|
||||
}&user_id=${this.user_id}`
|
||||
`${this.settings.siteUrl}/user/activate?token=${this.token}&user_id=${this.user_id}`
|
||||
)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
*/
|
||||
|
||||
@@ -22,14 +22,17 @@ module.exports = MockClient = class MockClient {
|
||||
this.disconnect = sinon.stub()
|
||||
this.id = idCounter++
|
||||
}
|
||||
|
||||
set(key, value, callback) {
|
||||
this.attributes[key] = value
|
||||
if (callback != null) {
|
||||
return callback()
|
||||
}
|
||||
}
|
||||
|
||||
get(key, callback) {
|
||||
return callback(null, this.attributes[key])
|
||||
}
|
||||
|
||||
disconnect() {}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ class MockRequest {
|
||||
this.prototype.accepts = () => {}
|
||||
this.prototype.setHeader = () => {}
|
||||
}
|
||||
|
||||
param(param) {
|
||||
return this.params[param]
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ class MockResponse {
|
||||
|
||||
this.prototype.contentType = sinon.stub()
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.rendered = false
|
||||
this.redirected = false
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable
|
||||
handle-callback-err,
|
||||
node/handle-callback-err,
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
|
||||
Reference in New Issue
Block a user