2019-05-29 05:21:06 -04:00
|
|
|
/* eslint-disable
|
|
|
|
camelcase,
|
2020-12-15 05:23:54 -05:00
|
|
|
node/handle-callback-err,
|
2019-05-29 05:21:06 -04:00
|
|
|
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('settings-sharelatex')
|
|
|
|
|
|
|
|
const joinProject = (user_id, project_id, callback) =>
|
|
|
|
request.post(
|
|
|
|
{
|
|
|
|
url: `/project/${project_id}/join`,
|
|
|
|
qs: { user_id },
|
|
|
|
auth: {
|
|
|
|
user: settings.apis.web.user,
|
|
|
|
pass: settings.apis.web.pass,
|
2021-04-27 03:52:58 -04:00
|
|
|
sendImmediately: true,
|
2019-05-29 05:21:06 -04:00
|
|
|
},
|
|
|
|
json: true,
|
2021-04-27 03:52:58 -04:00
|
|
|
jar: false,
|
2019-05-29 05:21:06 -04:00
|
|
|
},
|
|
|
|
callback
|
|
|
|
)
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
describe('ProjectFeatures', function () {
|
|
|
|
beforeEach(function (done) {
|
2019-05-29 05:21:06 -04:00
|
|
|
this.timeout(90000)
|
|
|
|
this.owner = new User()
|
|
|
|
return async.series([cb => this.owner.login(cb)], done)
|
|
|
|
})
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
describe('with private project', function () {
|
|
|
|
beforeEach(function (done) {
|
2019-05-29 05:21:06 -04:00
|
|
|
return this.owner.createProject(
|
|
|
|
'private-project',
|
|
|
|
(error, project_id) => {
|
|
|
|
if (error != null) {
|
|
|
|
return done(error)
|
|
|
|
}
|
|
|
|
this.project_id = project_id
|
|
|
|
return done()
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
describe('with an upgraded account', function () {
|
|
|
|
beforeEach(function (done) {
|
2019-05-29 05:21:06 -04:00
|
|
|
return this.owner.upgradeFeatures(done)
|
|
|
|
})
|
2021-04-14 09:17:21 -04:00
|
|
|
after(function (done) {
|
2019-05-29 05:21:06 -04:00
|
|
|
return this.owner.defaultFeatures(done)
|
|
|
|
})
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
it('should have premium features', function (done) {
|
2019-08-07 10:04:04 -04:00
|
|
|
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()
|
|
|
|
}
|
|
|
|
)
|
2019-05-29 05:21:06 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
describe('with an basic account', function () {
|
|
|
|
beforeEach(function (done) {
|
2019-05-29 05:21:06 -04:00
|
|
|
return this.owner.downgradeFeatures(done)
|
|
|
|
})
|
2021-04-14 09:17:21 -04:00
|
|
|
after(function (done) {
|
2019-05-29 05:21:06 -04:00
|
|
|
return this.owner.defaultFeatures(done)
|
|
|
|
})
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
it('should have basic features', function (done) {
|
2019-08-07 10:04:04 -04:00
|
|
|
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()
|
|
|
|
}
|
|
|
|
)
|
2019-05-29 05:21:06 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|