moved clone project from old proj controller to new one with test
This commit is contained in:
@@ -10,19 +10,31 @@ describe "ProjectController", ->
|
||||
|
||||
beforeEach ->
|
||||
|
||||
@project_id = "123213jlkj9kdlsaj"
|
||||
|
||||
@settings = {}
|
||||
@ProjectDeleter =
|
||||
deleteProject: sinon.stub().callsArgWith(1)
|
||||
@ProjectDuplicator =
|
||||
duplicate: sinon.stub().callsArgWith(3, null, {_id:@project_id})
|
||||
@ProjectController = SandboxedModule.require modulePath, requires:
|
||||
"settings-sharelatex":@settings
|
||||
"logger-sharelatex": log:->
|
||||
"./ProjectDeleter": @ProjectDeleter
|
||||
"./ProjectDuplicator": @ProjectDuplicator
|
||||
|
||||
|
||||
@project_id = "123213jlkj9kdlsaj"
|
||||
@user =
|
||||
_id:"!£123213kjljkl"
|
||||
first_name: "bjkdsjfk"
|
||||
@projectName = "£12321jkj9ujkljds"
|
||||
@req =
|
||||
params:
|
||||
Project_id: @project_id
|
||||
session:
|
||||
user: @user
|
||||
body:
|
||||
projectName: @projectName
|
||||
@res = {}
|
||||
|
||||
describe "deleteProject", ->
|
||||
@@ -35,3 +47,12 @@ describe "ProjectController", ->
|
||||
done()
|
||||
@ProjectController.deleteProject @req, @res
|
||||
|
||||
|
||||
describe "cloneProject", ->
|
||||
|
||||
it "should call the project duplicator", (done)->
|
||||
@res.send = (json)=>
|
||||
@ProjectDuplicator.duplicate.calledWith(@user, @project_id, @projectName).should.equal true
|
||||
json.project_id.should.equal @project_id
|
||||
done()
|
||||
@ProjectController.cloneProject @req, @res
|
||||
|
||||
Reference in New Issue
Block a user