|
|
@@ -240,10 +240,25 @@ describe('RestoreManager', function () {
|
|
|
this.DocumentUpdaterHandler.promises.setDocument = sinon
|
|
|
.stub()
|
|
|
.resolves()
|
|
|
+ this.EditorController.promises.deleteEntity = sinon.stub().resolves()
|
|
|
+ this.RestoreManager.promises._getRangesFromHistory = sinon
|
|
|
+ .stub()
|
|
|
+ .resolves({ changes: [], comments: [] })
|
|
|
+ this.DocstoreManager.promises.getAllRanges = sinon.stub().resolves([])
|
|
|
+ this.ChatApiHandler.promises.generateThreadData = sinon
|
|
|
+ .stub()
|
|
|
+ .resolves({})
|
|
|
+ this.ChatManager.promises.injectUserInfoIntoThreads = sinon
|
|
|
+ .stub()
|
|
|
+ .resolves()
|
|
|
+ this.EditorRealTimeController.emitToRoom = sinon.stub()
|
|
|
+ this.EditorController.promises.addDocWithRanges = sinon
|
|
|
+ .stub()
|
|
|
+ .resolves()
|
|
|
})
|
|
|
|
|
|
- it('should call setDocument in document updater and revert file', async function () {
|
|
|
- const revertRes = await this.RestoreManager.promises.revertFile(
|
|
|
+ it('should delete the existing document', async function () {
|
|
|
+ await this.RestoreManager.promises.revertFile(
|
|
|
this.user_id,
|
|
|
this.project_id,
|
|
|
this.version,
|
|
|
@@ -251,15 +266,14 @@ describe('RestoreManager', function () {
|
|
|
)
|
|
|
|
|
|
expect(
|
|
|
- this.DocumentUpdaterHandler.promises.setDocument
|
|
|
+ this.EditorController.promises.deleteEntity
|
|
|
).to.have.been.calledWith(
|
|
|
this.project_id,
|
|
|
'mock-file-id',
|
|
|
- this.user_id,
|
|
|
- ['foo', 'bar', 'baz'],
|
|
|
- 'file-revert'
|
|
|
+ 'doc',
|
|
|
+ 'revert',
|
|
|
+ this.user_id
|
|
|
)
|
|
|
- expect(revertRes).to.deep.equal({ _id: 'mock-file-id', type: 'doc' })
|
|
|
})
|
|
|
})
|
|
|
|