Merge pull request #2081 from overleaf/cmg-per-user-trash

Add per-user trashed state to project model

GitOrigin-RevId: 16a753702d3503eee011dd2adca5dc8df3da87f4
This commit is contained in:
Chrystal Maria Griffiths
2019-08-27 10:50:05 +00:00
committed by sharelatex
parent c1f8ac8de1
commit 6f2b4d3da3
7 changed files with 84 additions and 23 deletions
@@ -47,7 +47,9 @@ describe('ProjectLocator', function() {
getProject: sinon.stub().callsArgWith(2, null, project)
}
this.ProjectHelper = {
isArchived: sinon.stub()
isArchived: sinon.stub(),
isTrashed: sinon.stub(),
isArchivedOrTrashed: sinon.stub()
}
this.locator = SandboxedModule.require(modulePath, {
globals: {
@@ -602,31 +604,31 @@ describe('ProjectLocator', function() {
owned: [
{ name: 'notThis' },
{ name: 'wellll' },
{ name: 'findThis', archived: true },
{ name: 'findThis', archived: true, trashed: true },
stubbedProject,
{ name: 'findThis', archived: true },
{ name: 'Noooo' }
{ name: 'findThis', archived: true, trashed: false },
{ name: 'Noooo', trashed: true }
]
}
this.ProjectHelper.isArchived
this.ProjectHelper.isArchivedOrTrashed
.withArgs(projects.owned[0], userId)
.returns(false)
this.ProjectHelper.isArchived
this.ProjectHelper.isArchivedOrTrashed
.withArgs(projects.owned[1], userId)
.returns(false)
this.ProjectHelper.isArchived
this.ProjectHelper.isArchivedOrTrashed
.withArgs(projects.owned[2], userId)
.returns(true)
this.ProjectHelper.isArchived
this.ProjectHelper.isArchivedOrTrashed
.withArgs(projects.owned[3], userId)
.returns(false)
this.ProjectHelper.isArchived
this.ProjectHelper.isArchivedOrTrashed
.withArgs(projects.owned[4], userId)
.returns(true)
this.ProjectHelper.isArchived
this.ProjectHelper.isArchivedOrTrashed
.withArgs(projects.owned[5], userId)
.returns(false)
.returns(true)
this.ProjectGetter.findAllUsersProjects = sinon
.stub()