Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2 GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
@@ -18,8 +18,8 @@ const ProjectHelper = require('../../../../app/src/Features/Project/ProjectHelpe
|
||||
|
||||
const modulePath = '../../../../app/src/Features/Templates/TemplatesController'
|
||||
|
||||
describe('TemplatesController', function() {
|
||||
beforeEach(function() {
|
||||
describe('TemplatesController', function () {
|
||||
beforeEach(function () {
|
||||
this.user_id = 'user-id'
|
||||
this.TemplatesController = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
@@ -52,9 +52,9 @@ describe('TemplatesController', function() {
|
||||
return (this.res = { redirect: sinon.stub() })
|
||||
})
|
||||
|
||||
describe('createProjectFromV1Template', function() {
|
||||
describe('on success', function() {
|
||||
beforeEach(function() {
|
||||
describe('createProjectFromV1Template', function () {
|
||||
describe('on success', function () {
|
||||
beforeEach(function () {
|
||||
this.project = { _id: 'project-id' }
|
||||
this.TemplatesManager.createProjectFromV1Template.yields(
|
||||
null,
|
||||
@@ -67,7 +67,7 @@ describe('TemplatesController', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should call TemplatesManager', function() {
|
||||
it('should call TemplatesManager', function () {
|
||||
return this.TemplatesManager.createProjectFromV1Template.should.have.been.calledWithMatch(
|
||||
'brand-variation-id',
|
||||
'compiler',
|
||||
@@ -79,19 +79,19 @@ describe('TemplatesController', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should redirect to project', function() {
|
||||
it('should redirect to project', function () {
|
||||
return this.res.redirect.should.have.been.calledWith(
|
||||
'/project/project-id'
|
||||
)
|
||||
})
|
||||
|
||||
it('should delete session', function() {
|
||||
it('should delete session', function () {
|
||||
return expect(this.req.session.templateData).to.be.undefined
|
||||
})
|
||||
})
|
||||
|
||||
describe('on error', function() {
|
||||
beforeEach(function() {
|
||||
describe('on error', function () {
|
||||
beforeEach(function () {
|
||||
this.TemplatesManager.createProjectFromV1Template.yields('error')
|
||||
return this.TemplatesController.createProjectFromV1Template(
|
||||
this.req,
|
||||
@@ -100,11 +100,11 @@ describe('TemplatesController', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should call next with error', function() {
|
||||
it('should call next with error', function () {
|
||||
return this.next.should.have.been.calledWith('error')
|
||||
})
|
||||
|
||||
it('should not redirect', function() {
|
||||
it('should not redirect', function () {
|
||||
return this.res.redirect.called.should.equal(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -16,8 +16,8 @@ const sinon = require('sinon')
|
||||
|
||||
const modulePath = '../../../../app/src/Features/Templates/TemplatesManager'
|
||||
|
||||
describe('TemplatesManager', function() {
|
||||
beforeEach(function() {
|
||||
describe('TemplatesManager', function () {
|
||||
beforeEach(function () {
|
||||
this.project_id = 'project-id'
|
||||
this.brandVariationId = 'brand-variation-id'
|
||||
this.compiler = 'pdflatex'
|
||||
@@ -100,9 +100,9 @@ describe('TemplatesManager', function() {
|
||||
'%2Ftemplates%2F52fb86a81ae1e566597a25f6%2Fv%2F4%2Fzip&templateName=Moderncv%20Banking&compiler=pdflatex')
|
||||
})
|
||||
|
||||
describe('createProjectFromV1Template', function() {
|
||||
describe('when all options passed', function() {
|
||||
beforeEach(function() {
|
||||
describe('createProjectFromV1Template', function () {
|
||||
describe('when all options passed', function () {
|
||||
beforeEach(function () {
|
||||
return this.TemplatesManager.createProjectFromV1Template(
|
||||
this.brandVariationId,
|
||||
this.compiler,
|
||||
@@ -116,19 +116,19 @@ describe('TemplatesManager', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should fetch zip from v1 based on template id', function() {
|
||||
it('should fetch zip from v1 based on template id', function () {
|
||||
return this.request.should.have.been.calledWith(
|
||||
`${this.v1Url}/api/v1/sharelatex/templates/${this.templateVersionId}`
|
||||
)
|
||||
})
|
||||
|
||||
it('should save temporary file', function() {
|
||||
it('should save temporary file', function () {
|
||||
return this.fs.createWriteStream.should.have.been.calledWith(
|
||||
this.dumpPath
|
||||
)
|
||||
})
|
||||
|
||||
it('should create project', function() {
|
||||
it('should create project', function () {
|
||||
return this.ProjectUploadManager.createProjectFromZipArchiveWithName.should.have.been.calledWithMatch(
|
||||
this.user_id,
|
||||
this.templateName,
|
||||
@@ -140,11 +140,11 @@ describe('TemplatesManager', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should unlink file', function() {
|
||||
it('should unlink file', function () {
|
||||
return this.fs.unlink.should.have.been.calledWith(this.dumpPath)
|
||||
})
|
||||
|
||||
it('should set project options when passed', function() {
|
||||
it('should set project options when passed', function () {
|
||||
this.ProjectOptionsHandler.setCompiler.should.have.been.calledWithMatch(
|
||||
this.project_id,
|
||||
this.compiler
|
||||
@@ -163,7 +163,7 @@ describe('TemplatesManager', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should update project', function() {
|
||||
it('should update project', function () {
|
||||
return this.Project.updateOne.should.have.been.calledWithMatch(
|
||||
{ _id: this.project_id },
|
||||
{
|
||||
@@ -173,13 +173,13 @@ describe('TemplatesManager', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should ensure that the dump folder exists', function() {
|
||||
it('should ensure that the dump folder exists', function () {
|
||||
return sinon.assert.called(this.FileWriter.ensureDumpFolderExists)
|
||||
})
|
||||
})
|
||||
|
||||
describe('when some options not set', function() {
|
||||
beforeEach(function() {
|
||||
describe('when some options not set', function () {
|
||||
beforeEach(function () {
|
||||
return this.TemplatesManager.createProjectFromV1Template(
|
||||
null,
|
||||
null,
|
||||
@@ -193,7 +193,7 @@ describe('TemplatesManager', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should not set missing project options', function() {
|
||||
it('should not set missing project options', function () {
|
||||
this.ProjectOptionsHandler.setCompiler.called.should.equal(false)
|
||||
this.ProjectRootDocManager.setRootDocFromName.called.should.equal(false)
|
||||
this.ProjectOptionsHandler.setBrandVariationId.called.should.equal(
|
||||
|
||||
Reference in New Issue
Block a user