Merge pull request #12219 from overleaf/em-camel-case-web

Camel case variables in web

GitOrigin-RevId: 28e61b759b27f71265f33ab64f588374dba610e0
This commit is contained in:
Eric Mc Sween
2023-03-21 09:21:57 -04:00
committed by Copybot
parent e4efe121da
commit 21971956b7
56 changed files with 685 additions and 742 deletions
@@ -1,5 +1,4 @@
/* eslint-disable
camelcase,
n/handle-callback-err,
max-len,
no-return-assign,
@@ -20,7 +19,7 @@ const modulePath =
const SandboxedModule = require('sandboxed-module')
describe('ProjectOptionsHandler', function () {
const project_id = '4eecaffcbffa66588e000008'
const projectId = '4eecaffcbffa66588e000008'
beforeEach(function () {
let Project
@@ -49,16 +48,16 @@ describe('ProjectOptionsHandler', function () {
describe('Setting the compiler', function () {
it('should perform and update on mongo', function (done) {
this.handler.setCompiler(project_id, 'xeLaTeX', err => {
this.handler.setCompiler(projectId, 'xeLaTeX', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
args[0]._id.should.equal(projectId)
args[1].compiler.should.equal('xelatex')
done()
})
})
it('should not perform and update on mongo if it is not a recognised compiler', function (done) {
this.handler.setCompiler(project_id, 'something', err => {
this.handler.setCompiler(projectId, 'something', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
@@ -66,7 +65,7 @@ describe('ProjectOptionsHandler', function () {
describe('when called without arg', function () {
it('should callback with null', function (done) {
this.handler.setCompiler(project_id, null, err => {
this.handler.setCompiler(projectId, null, err => {
expect(err).to.be.undefined
this.projectModel.updateOne.callCount.should.equal(0)
done()
@@ -80,7 +79,7 @@ describe('ProjectOptionsHandler', function () {
})
it('should callback with error', function (done) {
this.handler.setCompiler(project_id, 'xeLaTeX', err => {
this.handler.setCompiler(projectId, 'xeLaTeX', err => {
err.should.equal('error')
done()
})
@@ -90,16 +89,16 @@ describe('ProjectOptionsHandler', function () {
describe('Setting the imageName', function () {
it('should perform and update on mongo', function (done) {
this.handler.setImageName(project_id, 'texlive-1234.5', err => {
this.handler.setImageName(projectId, 'texlive-1234.5', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
args[0]._id.should.equal(projectId)
args[1].imageName.should.equal('docker-repo/subdir/texlive-1234.5')
done()
})
})
it('should not perform and update on mongo if it is not a reconised compiler', function (done) {
this.handler.setImageName(project_id, 'something', err => {
this.handler.setImageName(projectId, 'something', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
@@ -107,7 +106,7 @@ describe('ProjectOptionsHandler', function () {
describe('when called without arg', function () {
it('should callback with null', function (done) {
this.handler.setImageName(project_id, null, err => {
this.handler.setImageName(projectId, null, err => {
expect(err).to.be.undefined
this.projectModel.updateOne.callCount.should.equal(0)
done()
@@ -121,7 +120,7 @@ describe('ProjectOptionsHandler', function () {
})
it('should callback with error', function (done) {
this.handler.setImageName(project_id, 'texlive-1234.5', err => {
this.handler.setImageName(projectId, 'texlive-1234.5', err => {
err.should.equal('error')
done()
})
@@ -131,23 +130,23 @@ describe('ProjectOptionsHandler', function () {
describe('setting the spellCheckLanguage', function () {
it('should perform and update on mongo', function (done) {
this.handler.setSpellCheckLanguage(project_id, 'fr', err => {
this.handler.setSpellCheckLanguage(projectId, 'fr', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
args[0]._id.should.equal(projectId)
args[1].spellCheckLanguage.should.equal('fr')
done()
})
})
it('should not perform and update on mongo if it is not a reconised compiler', function (done) {
this.handler.setSpellCheckLanguage(project_id, 'no a lang', err => {
this.handler.setSpellCheckLanguage(projectId, 'no a lang', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
it('should perform and update on mongo if the language is blank (means turn it off)', function (done) {
this.handler.setSpellCheckLanguage(project_id, '', err => {
this.handler.setSpellCheckLanguage(projectId, '', err => {
this.projectModel.updateOne.called.should.equal(true)
done()
})
@@ -159,7 +158,7 @@ describe('ProjectOptionsHandler', function () {
})
it('should callback with error', function (done) {
this.handler.setSpellCheckLanguage(project_id, 'fr', err => {
this.handler.setSpellCheckLanguage(projectId, 'fr', err => {
err.should.equal('error')
done()
})
@@ -169,23 +168,23 @@ describe('ProjectOptionsHandler', function () {
describe('setting the brandVariationId', function () {
it('should perform and update on mongo', function (done) {
this.handler.setBrandVariationId(project_id, '123', err => {
this.handler.setBrandVariationId(projectId, '123', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
args[0]._id.should.equal(projectId)
args[1].brandVariationId.should.equal('123')
done()
})
})
it('should not perform and update on mongo if there is no brand variation', function (done) {
this.handler.setBrandVariationId(project_id, null, err => {
this.handler.setBrandVariationId(projectId, null, err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
it('should not perform and update on mongo if brand variation is an empty string', function (done) {
this.handler.setBrandVariationId(project_id, '', err => {
this.handler.setBrandVariationId(projectId, '', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
@@ -197,7 +196,7 @@ describe('ProjectOptionsHandler', function () {
})
it('should callback with error', function (done) {
this.handler.setBrandVariationId(project_id, '123', err => {
this.handler.setBrandVariationId(projectId, '123', err => {
err.should.equal('error')
done()
})
@@ -207,9 +206,9 @@ describe('ProjectOptionsHandler', function () {
describe('unsetting the brandVariationId', function () {
it('should perform and update on mongo', function (done) {
this.handler.unsetBrandVariationId(project_id, err => {
this.handler.unsetBrandVariationId(projectId, err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
args[0]._id.should.equal(projectId)
expect(args[1]).to.deep.equal({ $unset: { brandVariationId: 1 } })
done()
})
@@ -221,7 +220,7 @@ describe('ProjectOptionsHandler', function () {
})
it('should callback with error', function (done) {
this.handler.unsetBrandVariationId(project_id, err => {
this.handler.unsetBrandVariationId(projectId, err => {
err.should.equal('error')
done()
})