[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:
Domagoj Kriskovic 2024-06-27 12:33:39 +02:00 committed by Copybot
parent b7b40e6057
commit c3c97d9fb9
2 changed files with 9 additions and 6 deletions

View file

@ -185,7 +185,7 @@ const RestoreManager = {
newCommentThreadData
)
return await EditorController.promises.addDocWithRanges(
const { _id } = await EditorController.promises.addDocWithRanges(
projectId,
parentFolderId,
basename,
@ -194,6 +194,11 @@ const RestoreManager = {
origin,
userId
)
return {
_id,
type: importInfo.type,
}
},
async _findOrCreateFolder(projectId, dirname) {

View file

@ -291,9 +291,7 @@ describe('RestoreManager', function () {
.resolves([{ toV: this.version, meta: { end_ts: Date.now() } }])
this.EditorController.promises.addDocWithRanges = sinon
.stub()
.resolves(
(this.addedFile = { doc: 'mock-doc', folderId: 'mock-folder' })
)
.resolves((this.addedFile = { _id: 'mock-doc', type: 'doc' }))
})
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 () {
expect(this.data).to.equal(this.addedFile)
expect(this.data).to.deep.equal(this.addedFile)
})
it('should look up ranges', function () {
@ -408,7 +406,7 @@ describe('RestoreManager', 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 () {