|
@@ -80,7 +80,9 @@ describe('ProjectController', function() {
|
|
|
getProject: sinon.stub()
|
|
getProject: sinon.stub()
|
|
|
}
|
|
}
|
|
|
this.ProjectHelper = {
|
|
this.ProjectHelper = {
|
|
|
- isArchived: sinon.stub()
|
|
|
|
|
|
|
+ isArchived: sinon.stub(),
|
|
|
|
|
+ isTrashed: sinon.stub(),
|
|
|
|
|
+ isArchivedOrTrashed: sinon.stub()
|
|
|
}
|
|
}
|
|
|
this.AuthenticationController = {
|
|
this.AuthenticationController = {
|
|
|
getLoggedInUser: sinon.stub().callsArgWith(1, null, this.user),
|
|
getLoggedInUser: sinon.stub().callsArgWith(1, null, this.user),
|
|
@@ -878,6 +880,7 @@ describe('ProjectController', function() {
|
|
|
const projects = [
|
|
const projects = [
|
|
|
{
|
|
{
|
|
|
archived: true,
|
|
archived: true,
|
|
|
|
|
+ trashed: true,
|
|
|
id: 'a',
|
|
id: 'a',
|
|
|
name: 'A',
|
|
name: 'A',
|
|
|
accessLevel: 'a',
|
|
accessLevel: 'a',
|
|
@@ -892,6 +895,7 @@ describe('ProjectController', function() {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
archived: false,
|
|
archived: false,
|
|
|
|
|
+ trashed: true,
|
|
|
id: 'c',
|
|
id: 'c',
|
|
|
name: 'C',
|
|
name: 'C',
|
|
|
accessLevel: 'c',
|
|
accessLevel: 'c',
|
|
@@ -899,6 +903,7 @@ describe('ProjectController', function() {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
archived: false,
|
|
archived: false,
|
|
|
|
|
+ trashed: false,
|
|
|
id: 'd',
|
|
id: 'd',
|
|
|
name: 'D',
|
|
name: 'D',
|
|
|
accessLevel: 'd',
|
|
accessLevel: 'd',
|
|
@@ -906,16 +911,16 @@ describe('ProjectController', function() {
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
- this.ProjectHelper.isArchived
|
|
|
|
|
|
|
+ this.ProjectHelper.isArchivedOrTrashed
|
|
|
.withArgs(projects[0], this.user._id)
|
|
.withArgs(projects[0], this.user._id)
|
|
|
.returns(true)
|
|
.returns(true)
|
|
|
- this.ProjectHelper.isArchived
|
|
|
|
|
|
|
+ this.ProjectHelper.isArchivedOrTrashed
|
|
|
.withArgs(projects[1], this.user._id)
|
|
.withArgs(projects[1], this.user._id)
|
|
|
.returns(false)
|
|
.returns(false)
|
|
|
- this.ProjectHelper.isArchived
|
|
|
|
|
|
|
+ this.ProjectHelper.isArchivedOrTrashed
|
|
|
.withArgs(projects[2], this.user._id)
|
|
.withArgs(projects[2], this.user._id)
|
|
|
- .returns(false)
|
|
|
|
|
- this.ProjectHelper.isArchived
|
|
|
|
|
|
|
+ .returns(true)
|
|
|
|
|
+ this.ProjectHelper.isArchivedOrTrashed
|
|
|
.withArgs(projects[3], this.user._id)
|
|
.withArgs(projects[3], this.user._id)
|
|
|
.returns(false)
|
|
.returns(false)
|
|
|
|
|
|
|
@@ -934,7 +939,6 @@ describe('ProjectController', function() {
|
|
|
expect(data).to.deep.equal({
|
|
expect(data).to.deep.equal({
|
|
|
projects: [
|
|
projects: [
|
|
|
{ _id: 'b', name: 'B', accessLevel: 'b' },
|
|
{ _id: 'b', name: 'B', accessLevel: 'b' },
|
|
|
- { _id: 'c', name: 'C', accessLevel: 'c' },
|
|
|
|
|
{ _id: 'd', name: 'D', accessLevel: 'd' }
|
|
{ _id: 'd', name: 'D', accessLevel: 'd' }
|
|
|
]
|
|
]
|
|
|
})
|
|
})
|