|
|
@@ -159,6 +159,7 @@ describe('ProjectDuplicator', function() {
|
|
|
}
|
|
|
}
|
|
|
this.ProjectEntityUpdateHandler = {
|
|
|
+ isPathValidForRootDoc: sinon.stub().returns(true),
|
|
|
promises: {
|
|
|
setRootDoc: sinon.stub().resolves()
|
|
|
}
|
|
|
@@ -340,6 +341,22 @@ describe('ProjectDuplicator', function() {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
+ describe('with an invalid root doc', function() {
|
|
|
+ beforeEach(async function() {
|
|
|
+ this.ProjectEntityUpdateHandler.isPathValidForRootDoc.returns(false)
|
|
|
+ this.newProject = await this.ProjectDuplicator.promises.duplicate(
|
|
|
+ this.owner,
|
|
|
+ this.project._id,
|
|
|
+ 'Copy of project'
|
|
|
+ )
|
|
|
+ })
|
|
|
+
|
|
|
+ it('should not set the root doc on the copy', function() {
|
|
|
+ this.ProjectEntityUpdateHandler.promises.setRootDoc.should.not.have.been
|
|
|
+ .called
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
describe('when there is an error', function() {
|
|
|
beforeEach(async function() {
|
|
|
this.ProjectEntityMongoUpdateHandler.promises.createNewFolderStructure.rejects()
|