mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 00:03:44 -05:00
Merge pull request #4254 from overleaf/em-active-projects-expire
Unit test for not expiring active projects GitOrigin-RevId: 8b2f3d05c7f7e4c4d44e5487041f19d2bff9891a
This commit is contained in:
parent
a966a5f9d7
commit
9820b787a7
1 changed files with 93 additions and 51 deletions
|
@ -419,13 +419,12 @@ describe('ProjectDeleter', function () {
|
|||
})
|
||||
|
||||
describe('expireDeletedProject', function () {
|
||||
describe('on an inactive project', function () {
|
||||
beforeEach(async function () {
|
||||
for (const deletedProject of this.deletedProjects) {
|
||||
this.ProjectMock.expects('findById')
|
||||
.withArgs(deletedProject.deleterData.deletedProjectId)
|
||||
.withArgs(this.deletedProjects[0].deleterData.deletedProjectId)
|
||||
.chain('exec')
|
||||
.resolves(null)
|
||||
}
|
||||
this.DeletedProjectMock.expects('updateOne')
|
||||
.withArgs(
|
||||
{
|
||||
|
@ -487,6 +486,49 @@ describe('ProjectDeleter', function () {
|
|||
})
|
||||
})
|
||||
|
||||
describe('on an active project (from an incomplete delete)', function () {
|
||||
beforeEach(async function () {
|
||||
this.ProjectMock.expects('findById')
|
||||
.withArgs(this.deletedProjects[0].deleterData.deletedProjectId)
|
||||
.chain('exec')
|
||||
.resolves(this.deletedProjects[0].project)
|
||||
this.DeletedProjectMock.expects('deleteOne')
|
||||
.withArgs({
|
||||
'deleterData.deletedProjectId': this.deletedProjects[0].project._id,
|
||||
})
|
||||
.chain('exec')
|
||||
.resolves()
|
||||
await this.ProjectDeleter.promises.expireDeletedProject(
|
||||
this.deletedProjects[0].project._id
|
||||
)
|
||||
})
|
||||
|
||||
it('should delete the spurious deleted project record', function () {
|
||||
this.DeletedProjectMock.verify()
|
||||
})
|
||||
|
||||
it('should not destroy the docs in docstore', function () {
|
||||
expect(this.DocstoreManager.promises.destroyProject).to.not.have.been
|
||||
.called
|
||||
})
|
||||
|
||||
it('should not delete the project in history', function () {
|
||||
expect(this.HistoryManager.promises.deleteProject).to.not.have.been
|
||||
.called
|
||||
})
|
||||
|
||||
it('should not destroy the files in filestore', function () {
|
||||
expect(this.FileStoreHandler.promises.deleteProject).to.not.have.been
|
||||
.called
|
||||
})
|
||||
|
||||
it('should not destroy the files in project-archiver', function () {
|
||||
expect(this.TpdsUpdateSender.promises.deleteProject).to.not.have.been
|
||||
.called
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('archiveProject', function () {
|
||||
beforeEach(function () {
|
||||
const archived = [ObjectId(this.user._id)]
|
||||
|
|
Loading…
Reference in a new issue