mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 05:11:34 +02:00
Merge pull request #9658 from overleaf/em-dropbox-folder-sync
Sync folder creation from Dropbox to Overleaf GitOrigin-RevId: a2749ab8d9db7dd312818b46d6e72f1dbaaaff2e
This commit is contained in:
@@ -144,7 +144,7 @@ describe('ProjectEntityMongoUpdateHandler', function () {
|
||||
path: '/',
|
||||
})
|
||||
)
|
||||
.resolves({ element: this.rootFolder, type: 'folder' })
|
||||
.resolves({ element: this.rootFolder, type: 'folder', folder: null })
|
||||
this.ProjectLocator.promises.findElementByPath
|
||||
.withArgs(
|
||||
sinon.match({
|
||||
@@ -152,7 +152,11 @@ describe('ProjectEntityMongoUpdateHandler', function () {
|
||||
path: '/test-folder',
|
||||
})
|
||||
)
|
||||
.resolves({ element: this.folder, type: 'folder' })
|
||||
.resolves({
|
||||
element: this.folder,
|
||||
type: 'folder',
|
||||
folder: this.rootFolder,
|
||||
})
|
||||
this.ProjectLocator.promises.findElementByPath
|
||||
.withArgs(
|
||||
sinon.match({
|
||||
@@ -160,7 +164,11 @@ describe('ProjectEntityMongoUpdateHandler', function () {
|
||||
path: '/test-folder/test-subfolder',
|
||||
})
|
||||
)
|
||||
.resolves({ element: this.subfolder, type: 'folder' })
|
||||
.resolves({
|
||||
element: this.subfolder,
|
||||
type: 'folder',
|
||||
folder: this.folder,
|
||||
})
|
||||
|
||||
this.ProjectGetter = {
|
||||
promises: {
|
||||
@@ -437,9 +445,7 @@ describe('ProjectEntityMongoUpdateHandler', function () {
|
||||
})
|
||||
|
||||
it('should report the parent folder', function () {
|
||||
expect(this.result.folder.parentFolder_id).not.equal(
|
||||
this.rootFolder._id
|
||||
)
|
||||
expect(this.result.folder.parentFolder_id).to.equal(this.rootFolder._id)
|
||||
})
|
||||
|
||||
it('should not return new folders', function () {
|
||||
|
||||
@@ -308,12 +308,13 @@ describe('ProjectLocator', function () {
|
||||
const path = `${doc1.name}`
|
||||
this.locator.findElementByPath(
|
||||
{ project, path },
|
||||
(err, element, type) => {
|
||||
(err, element, type, folder) => {
|
||||
if (err != null) {
|
||||
return done(err)
|
||||
}
|
||||
element.should.deep.equal(doc1)
|
||||
expect(type).to.equal('doc')
|
||||
expect(folder).to.equal(rootFolder)
|
||||
done()
|
||||
}
|
||||
)
|
||||
@@ -323,12 +324,13 @@ describe('ProjectLocator', function () {
|
||||
const path = `/${doc1.name}`
|
||||
this.locator.findElementByPath(
|
||||
{ project, path },
|
||||
(err, element, type) => {
|
||||
(err, element, type, folder) => {
|
||||
if (err != null) {
|
||||
return done(err)
|
||||
}
|
||||
element.should.deep.equal(doc1)
|
||||
expect(type).to.equal('doc')
|
||||
expect(folder).to.equal(rootFolder)
|
||||
done()
|
||||
}
|
||||
)
|
||||
@@ -338,12 +340,13 @@ describe('ProjectLocator', function () {
|
||||
const path = `${subFolder.name}/${secondSubFolder.name}/${subSubDoc.name}`
|
||||
this.locator.findElementByPath(
|
||||
{ project, path },
|
||||
(err, element, type) => {
|
||||
(err, element, type, folder) => {
|
||||
if (err != null) {
|
||||
return done(err)
|
||||
}
|
||||
element.should.deep.equal(subSubDoc)
|
||||
expect(type).to.equal('doc')
|
||||
expect(folder).to.equal(secondSubFolder)
|
||||
done()
|
||||
}
|
||||
)
|
||||
@@ -353,12 +356,13 @@ describe('ProjectLocator', function () {
|
||||
const path = `${file1.name}`
|
||||
this.locator.findElementByPath(
|
||||
{ project, path },
|
||||
(err, element, type) => {
|
||||
(err, element, type, folder) => {
|
||||
if (err != null) {
|
||||
return done(err)
|
||||
}
|
||||
element.should.deep.equal(file1)
|
||||
expect(type).to.equal('file')
|
||||
expect(folder).to.equal(rootFolder)
|
||||
done()
|
||||
}
|
||||
)
|
||||
@@ -368,12 +372,13 @@ describe('ProjectLocator', function () {
|
||||
const path = `${subFolder.name}/${secondSubFolder.name}/${subSubFile.name}`
|
||||
this.locator.findElementByPath(
|
||||
{ project, path },
|
||||
(err, element, type) => {
|
||||
(err, element, type, folder) => {
|
||||
if (err != null) {
|
||||
return done(err)
|
||||
}
|
||||
element.should.deep.equal(subSubFile)
|
||||
expect(type).to.equal('file')
|
||||
expect(folder).to.equal(secondSubFolder)
|
||||
done()
|
||||
}
|
||||
)
|
||||
@@ -383,12 +388,13 @@ describe('ProjectLocator', function () {
|
||||
const path = `${subFolder.name.toUpperCase()}/${secondSubFolder.name.toUpperCase()}/${subSubFile.name.toUpperCase()}`
|
||||
this.locator.findElementByPath(
|
||||
{ project, path },
|
||||
(err, element, type) => {
|
||||
(err, element, type, folder) => {
|
||||
if (err != null) {
|
||||
return done(err)
|
||||
}
|
||||
element.should.deep.equal(subSubFile)
|
||||
expect(type).to.equal('file')
|
||||
expect(folder).to.equal(secondSubFolder)
|
||||
done()
|
||||
}
|
||||
)
|
||||
@@ -398,12 +404,13 @@ describe('ProjectLocator', function () {
|
||||
const path = `${subFolder.name}/${secondSubFolder.name}`
|
||||
this.locator.findElementByPath(
|
||||
{ project, path },
|
||||
(err, element, type) => {
|
||||
(err, element, type, folder) => {
|
||||
if (err != null) {
|
||||
return done(err)
|
||||
}
|
||||
element.should.deep.equal(secondSubFolder)
|
||||
expect(type).to.equal('folder')
|
||||
expect(folder).to.equal(subFolder)
|
||||
done()
|
||||
}
|
||||
)
|
||||
@@ -413,12 +420,13 @@ describe('ProjectLocator', function () {
|
||||
const path = '/'
|
||||
this.locator.findElementByPath(
|
||||
{ project, path },
|
||||
(err, element, type) => {
|
||||
(err, element, type, folder) => {
|
||||
if (err != null) {
|
||||
return done(err)
|
||||
}
|
||||
element.should.deep.equal(rootFolder)
|
||||
expect(type).to.equal('folder')
|
||||
expect(folder).to.equal(null)
|
||||
done()
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user