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 11:38:17 +01:00
committed by sharelatex
parent c1f8ac8de1
commit 6f2b4d3da3
7 changed files with 84 additions and 23 deletions
@@ -68,6 +68,43 @@ describe('ProjectHelper', function() {
).to.equal(false)
})
})
describe('project.archived being undefined', function() {
it('returns false if archived is undefined', function() {
this.project.archived = undefined
expect(
this.ProjectHelper.isArchived(this.project, this.user._id)
).to.equal(false)
})
})
})
describe('isTrashed', function() {
it('returns true if user id is found', function() {
this.project.trashed = [
ObjectId('588f3ddae8ebc1bac07c9fa4'),
ObjectId('5c41deb2b4ca500153340809')
]
expect(
this.ProjectHelper.isTrashed(this.project, this.user._id)
).to.equal(true)
})
it('returns false if user id is not found', function() {
this.project.trashed = []
expect(
this.ProjectHelper.isTrashed(this.project, this.user._id)
).to.equal(false)
})
describe('project.trashed being undefined', function() {
it('returns false if trashed is undefined', function() {
this.project.trashed = undefined
expect(
this.ProjectHelper.isTrashed(this.project, this.user._id)
).to.equal(false)
})
})
})
describe('compilerFromV1Engine', function() {