mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-09 00:41:40 +00:00
[web] return file type in revertFile (#18995)
* [web] return file type in revertFile * fix revertFile unit test * fix formatting GitOrigin-RevId: e4ac0500ff6c72c7f7fa23a5f61b09ed31a28da0
This commit is contained in:
parent
b7b40e6057
commit
c3c97d9fb9
2 changed files with 9 additions and 6 deletions
|
@ -185,7 +185,7 @@ const RestoreManager = {
|
||||||
newCommentThreadData
|
newCommentThreadData
|
||||||
)
|
)
|
||||||
|
|
||||||
return await EditorController.promises.addDocWithRanges(
|
const { _id } = await EditorController.promises.addDocWithRanges(
|
||||||
projectId,
|
projectId,
|
||||||
parentFolderId,
|
parentFolderId,
|
||||||
basename,
|
basename,
|
||||||
|
@ -194,6 +194,11 @@ const RestoreManager = {
|
||||||
origin,
|
origin,
|
||||||
userId
|
userId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
_id,
|
||||||
|
type: importInfo.type,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async _findOrCreateFolder(projectId, dirname) {
|
async _findOrCreateFolder(projectId, dirname) {
|
||||||
|
|
|
@ -291,9 +291,7 @@ describe('RestoreManager', function () {
|
||||||
.resolves([{ toV: this.version, meta: { end_ts: Date.now() } }])
|
.resolves([{ toV: this.version, meta: { end_ts: Date.now() } }])
|
||||||
this.EditorController.promises.addDocWithRanges = sinon
|
this.EditorController.promises.addDocWithRanges = sinon
|
||||||
.stub()
|
.stub()
|
||||||
.resolves(
|
.resolves((this.addedFile = { _id: 'mock-doc', type: 'doc' }))
|
||||||
(this.addedFile = { doc: 'mock-doc', folderId: 'mock-folder' })
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("when reverting a file that doesn't current exist", function () {
|
describe("when reverting a file that doesn't current exist", function () {
|
||||||
|
@ -327,7 +325,7 @@ describe('RestoreManager', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return the created entity', function () {
|
it('should return the created entity', function () {
|
||||||
expect(this.data).to.equal(this.addedFile)
|
expect(this.data).to.deep.equal(this.addedFile)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should look up ranges', function () {
|
it('should look up ranges', function () {
|
||||||
|
@ -408,7 +406,7 @@ describe('RestoreManager', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return the created entity', function () {
|
it('should return the created entity', function () {
|
||||||
expect(this.data).to.equal(this.addedFile)
|
expect(this.data).to.deep.equal(this.addedFile)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should look up ranges', function () {
|
it('should look up ranges', function () {
|
||||||
|
|
Loading…
Reference in a new issue