Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Tocker committed Nov 25, 2016
2 parents 7baa689 + 4e328a9 commit 826b4b6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/utils.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/utils.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -821,13 +821,14 @@ exports.archive_params = (options = {})->
mode: options.mode
notification_url: options.notification_url
prefixes: options.prefixes && exports.build_array(options.prefixes)
transformations: utils.build_eager(options.transformations)
public_ids: options.public_ids && exports.build_array(options.public_ids)
tags: options.tags && exports.build_array(options.tags)
target_format: options.target_format
target_public_id: options.target_public_id
target_tags: options.target_tags && exports.build_array(options.target_tags)
timestamp: (options.timestamp ? exports.timestamp())
transformations: build_eager(options.transformations)
transformations: utils.build_eager(options.transformations)
type: options.type
use_original_filename: exports.as_safe_bool(options.use_original_filename)

Expand All @@ -840,7 +841,7 @@ exports.build_explicit_api_params = (public_id, options = {})->
opt = [
callback: options.callback
custom_coordinates: options.custom_coordinates && utils.encode_double_array(options.custom_coordinates)
eager: build_eager(options.eager)
eager: utils.build_eager(options.eager)
eager_async: utils.as_safe_bool(options.eager_async)
eager_notification_url: options.eager_notification_url
face_coordinates: options.face_coordinates && utils.encode_double_array(options.face_coordinates)
Expand Down
18 changes: 18 additions & 0 deletions test/utils_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,24 @@ describe "utils", ->
expect(utils.build_upload_params(options)['transformation']).to.eql("c_scale,w_100")
expect(Object.keys(options).length).to.eql(2)

it "build_explicit_api_params should support mutiple eager transformations with a pipe" , ->
options = {
eager: [
{width:100, crop:"scale"},
{height:100, crop:"fit"},
]
}
expect(utils.build_explicit_api_params('some_id', options)[0]['eager']).to.eql("c_scale,w_100|c_fit,h_100")

it "archive_params should support mutiple eager transformations with a pipe" , ->
options = {
transformations: [
{width:200, crop:"scale"},
{height:200, crop:"fit"},
]
}
expect(utils.archive_params(options)['transformations']).to.eql("c_scale,w_200|c_fit,h_200")

it "build_upload_params canonize booleans" , ->
options = {backup:true, use_filename:false, colors:"true", exif:"false", colors:"true", image_metadata:"false", invalidate:1, eager_async:"1"}
params = utils.build_upload_params(options)
Expand Down

0 comments on commit 826b4b6

Please sign in to comment.