|
|
@@ -10,6 +10,13 @@ describe 'ExportsController', ->
|
|
|
project_id = "123njdskj9jlk"
|
|
|
user_id = "123nd3ijdks"
|
|
|
brand_variation_id = 22
|
|
|
+ firstName = 'first'
|
|
|
+ lastName = 'last'
|
|
|
+ title = "title"
|
|
|
+ description = "description"
|
|
|
+ author = "author"
|
|
|
+ license = "other"
|
|
|
+ show_source = true
|
|
|
|
|
|
beforeEach ->
|
|
|
@handler =
|
|
|
@@ -18,6 +25,9 @@ describe 'ExportsController', ->
|
|
|
params:
|
|
|
project_id: project_id
|
|
|
brand_variation_id: brand_variation_id
|
|
|
+ body:
|
|
|
+ firstName: firstName
|
|
|
+ lastName: lastName
|
|
|
session:
|
|
|
user:
|
|
|
_id:user_id
|
|
|
@@ -32,16 +42,45 @@ describe 'ExportsController', ->
|
|
|
err:->
|
|
|
'../Authentication/AuthenticationController': @AuthenticationController
|
|
|
|
|
|
- it 'should ask the handler to perform the export', (done) ->
|
|
|
- @handler.exportProject = sinon.stub().yields(null, {iAmAnExport: true, v1_id: 897})
|
|
|
- expected =
|
|
|
- project_id: project_id
|
|
|
- user_id: user_id
|
|
|
- brand_variation_id: brand_variation_id
|
|
|
- @controller.exportProject @req, send:(body) =>
|
|
|
- expect(@handler.exportProject.args[0][0]).to.deep.equal expected
|
|
|
- expect(body).to.deep.equal {export_v1_id: 897}
|
|
|
- done()
|
|
|
+ describe "without gallery fields",->
|
|
|
+ it 'should ask the handler to perform the export', (done) ->
|
|
|
+ @handler.exportProject = sinon.stub().yields(null, {iAmAnExport: true, v1_id: 897})
|
|
|
+ expected =
|
|
|
+ project_id: project_id
|
|
|
+ user_id: user_id
|
|
|
+ brand_variation_id: brand_variation_id
|
|
|
+ first_name: firstName
|
|
|
+ last_name: lastName
|
|
|
+ @controller.exportProject @req, send:(body) =>
|
|
|
+ expect(@handler.exportProject.args[0][0]).to.deep.equal expected
|
|
|
+ expect(body).to.deep.equal {export_v1_id: 897}
|
|
|
+ done()
|
|
|
+
|
|
|
+ describe "with gallery fields",->
|
|
|
+ beforeEach ->
|
|
|
+ @req.body.title = title
|
|
|
+ @req.body.description = description
|
|
|
+ @req.body.author = author
|
|
|
+ @req.body.license = license
|
|
|
+ @req.body.show_source = true
|
|
|
+
|
|
|
+ it 'should ask the handler to perform the export', (done) ->
|
|
|
+ @handler.exportProject = sinon.stub().yields(null, {iAmAnExport: true, v1_id: 897})
|
|
|
+ expected =
|
|
|
+ project_id: project_id
|
|
|
+ user_id: user_id
|
|
|
+ brand_variation_id: brand_variation_id
|
|
|
+ first_name: firstName
|
|
|
+ last_name: lastName
|
|
|
+ title: title
|
|
|
+ description: description
|
|
|
+ author: author
|
|
|
+ license: license
|
|
|
+ show_source: show_source
|
|
|
+ @controller.exportProject @req, send:(body) =>
|
|
|
+ expect(@handler.exportProject.args[0][0]).to.deep.equal expected
|
|
|
+ expect(body).to.deep.equal {export_v1_id: 897}
|
|
|
+ done()
|
|
|
|
|
|
it 'should ask the handler to return the status of an export', (done) ->
|
|
|
@handler.fetchExport = sinon.stub().yields(
|