mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 21:01:33 +02:00
Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2 GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
@@ -15,8 +15,8 @@ const sinon = require('sinon')
|
||||
const modulePath = '../../../../app/src/Features/Metadata/MetaHandler'
|
||||
const SandboxedModule = require('sandboxed-module')
|
||||
|
||||
describe('MetaHandler', function() {
|
||||
beforeEach(function() {
|
||||
describe('MetaHandler', function () {
|
||||
beforeEach(function () {
|
||||
this.projectId = 'someprojectid'
|
||||
this.docId = 'somedocid'
|
||||
this.ProjectEntityHandler = {
|
||||
@@ -61,8 +61,8 @@ describe('MetaHandler', function() {
|
||||
}))
|
||||
})
|
||||
|
||||
describe('extractMetaFromDoc', function() {
|
||||
beforeEach(function() {
|
||||
describe('extractMetaFromDoc', function () {
|
||||
beforeEach(function () {
|
||||
return (this.lines = [
|
||||
'\\usepackage{foo}',
|
||||
'\\usepackage{amsmath, booktabs}',
|
||||
@@ -75,7 +75,7 @@ describe('MetaHandler', function() {
|
||||
])
|
||||
})
|
||||
|
||||
it('should extract all the labels and packages', function() {
|
||||
it('should extract all the labels and packages', function () {
|
||||
const docMeta = this.MetaHandler.extractMetaFromDoc(this.lines)
|
||||
return expect(docMeta).to.deep.equal({
|
||||
labels: ['aaa', 'bbb'],
|
||||
@@ -99,8 +99,8 @@ describe('MetaHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('extractMetaFromProjectDocs', function() {
|
||||
beforeEach(function() {
|
||||
describe('extractMetaFromProjectDocs', function () {
|
||||
beforeEach(function () {
|
||||
return (this.docs = {
|
||||
doc_one: {
|
||||
_id: 'id_one',
|
||||
@@ -135,7 +135,7 @@ describe('MetaHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should extract all metadata', function() {
|
||||
it('should extract all metadata', function () {
|
||||
const projectMeta = this.MetaHandler.extractMetaFromProjectDocs(this.docs)
|
||||
return expect(projectMeta).to.deep.equal({
|
||||
id_one: { labels: ['aaa'], packages: {} },
|
||||
@@ -185,8 +185,8 @@ describe('MetaHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('getMetaForDoc', function() {
|
||||
beforeEach(function() {
|
||||
describe('getMetaForDoc', function () {
|
||||
beforeEach(function () {
|
||||
this.fakeLines = ['\\usepackage{abc}', 'one', '\\label{aaa}', 'two']
|
||||
this.fakeMeta = { labels: ['aaa'], packages: ['abc'] }
|
||||
this.DocumentUpdaterHandler.flushDocToMongo = sinon
|
||||
@@ -205,21 +205,21 @@ describe('MetaHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should not produce an error', function(done) {
|
||||
it('should not produce an error', function (done) {
|
||||
return this.call((err, docMeta) => {
|
||||
expect(err).to.equal(null)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should produce docMeta', function(done) {
|
||||
it('should produce docMeta', function (done) {
|
||||
return this.call((err, docMeta) => {
|
||||
expect(docMeta).to.equal(this.fakeMeta)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should call flushDocToMongo', function(done) {
|
||||
it('should call flushDocToMongo', function (done) {
|
||||
return this.call((err, docMeta) => {
|
||||
this.DocumentUpdaterHandler.flushDocToMongo.callCount.should.equal(1)
|
||||
this.DocumentUpdaterHandler.flushDocToMongo
|
||||
@@ -229,7 +229,7 @@ describe('MetaHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should call getDoc', function(done) {
|
||||
it('should call getDoc', function (done) {
|
||||
return this.call((err, docMeta) => {
|
||||
this.ProjectEntityHandler.getDoc.callCount.should.equal(1)
|
||||
this.ProjectEntityHandler.getDoc
|
||||
@@ -239,7 +239,7 @@ describe('MetaHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should call extractMetaFromDoc', function(done) {
|
||||
it('should call extractMetaFromDoc', function (done) {
|
||||
return this.call((err, docMeta) => {
|
||||
this.MetaHandler.extractMetaFromDoc.callCount.should.equal(1)
|
||||
this.MetaHandler.extractMetaFromDoc
|
||||
@@ -250,8 +250,8 @@ describe('MetaHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('getAllMetaForProject', function() {
|
||||
beforeEach(function() {
|
||||
describe('getAllMetaForProject', function () {
|
||||
beforeEach(function () {
|
||||
this.fakeDocs = {
|
||||
doc_one: {
|
||||
lines: ['\\usepackage[some-options,more=foo]{foo}', '\\label{aaa}']
|
||||
@@ -291,21 +291,21 @@ describe('MetaHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should not produce an error', function(done) {
|
||||
it('should not produce an error', function (done) {
|
||||
return this.call((err, projectMeta) => {
|
||||
expect(err).to.equal(null)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should produce projectMeta', function(done) {
|
||||
it('should produce projectMeta', function (done) {
|
||||
return this.call((err, projectMeta) => {
|
||||
expect(projectMeta).to.equal(this.fakeMeta)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should call getAllDocs', function(done) {
|
||||
it('should call getAllDocs', function (done) {
|
||||
return this.call((err, projectMeta) => {
|
||||
this.ProjectEntityHandler.getAllDocs.callCount.should.equal(1)
|
||||
this.ProjectEntityHandler.getAllDocs
|
||||
@@ -315,7 +315,7 @@ describe('MetaHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should call extractMetaFromDoc', function(done) {
|
||||
it('should call extractMetaFromDoc', function (done) {
|
||||
return this.call((err, docMeta) => {
|
||||
this.MetaHandler.extractMetaFromProjectDocs.callCount.should.equal(1)
|
||||
this.MetaHandler.extractMetaFromProjectDocs
|
||||
|
||||
Reference in New Issue
Block a user