mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 19:53:41 -05:00
385d3f9c1b
[misc] joinProject: pass userId and anonymous access token in body 2/2 GitOrigin-RevId: b1a11941a6d9c7cc779769d1e97d3a0f03bed610
98 lines
2.9 KiB
JavaScript
98 lines
2.9 KiB
JavaScript
/* eslint-disable
|
|
n/handle-callback-err,
|
|
max-len,
|
|
*/
|
|
// 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
|
|
* DS207: Consider shorter variations of null checks
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
*/
|
|
const { expect } = require('chai')
|
|
const async = require('async')
|
|
const User = require('./helpers/User')
|
|
const request = require('./helpers/request')
|
|
const settings = require('@overleaf/settings')
|
|
|
|
const joinProject = (userId, projectId, callback) =>
|
|
request.post(
|
|
{
|
|
url: `/project/${projectId}/join`,
|
|
auth: {
|
|
user: settings.apis.web.user,
|
|
pass: settings.apis.web.pass,
|
|
sendImmediately: true,
|
|
},
|
|
json: { userId },
|
|
jar: false,
|
|
},
|
|
callback
|
|
)
|
|
|
|
describe('ProjectFeatures', function () {
|
|
beforeEach(function (done) {
|
|
this.timeout(90000)
|
|
this.owner = new User()
|
|
return async.series([cb => this.owner.login(cb)], done)
|
|
})
|
|
|
|
describe('with private project', function () {
|
|
beforeEach(function (done) {
|
|
return this.owner.createProject('private-project', (error, projectId) => {
|
|
if (error != null) {
|
|
return done(error)
|
|
}
|
|
this.project_id = projectId
|
|
return done()
|
|
})
|
|
})
|
|
|
|
describe('with an upgraded account', function () {
|
|
beforeEach(function (done) {
|
|
return this.owner.upgradeFeatures(done)
|
|
})
|
|
after(function (done) {
|
|
return this.owner.defaultFeatures(done)
|
|
})
|
|
|
|
it('should have premium features', function (done) {
|
|
return joinProject(
|
|
this.owner._id,
|
|
this.project_id,
|
|
(error, response, body) => {
|
|
expect(body.project.features.compileGroup).to.equal('priority')
|
|
expect(body.project.features.versioning).to.equal(true)
|
|
expect(body.project.features.templates).to.equal(true)
|
|
expect(body.project.features.dropbox).to.equal(true)
|
|
return done()
|
|
}
|
|
)
|
|
})
|
|
})
|
|
|
|
describe('with an basic account', function () {
|
|
beforeEach(function (done) {
|
|
return this.owner.downgradeFeatures(done)
|
|
})
|
|
after(function (done) {
|
|
return this.owner.defaultFeatures(done)
|
|
})
|
|
|
|
it('should have basic features', function (done) {
|
|
return joinProject(
|
|
this.owner._id,
|
|
this.project_id,
|
|
(error, response, body) => {
|
|
expect(body.project.features.compileGroup).to.equal('standard')
|
|
expect(body.project.features.versioning).to.equal(false)
|
|
expect(body.project.features.templates).to.equal(false)
|
|
expect(body.project.features.dropbox).to.equal(false)
|
|
return done()
|
|
}
|
|
)
|
|
})
|
|
})
|
|
})
|
|
})
|