diff --git a/test/utils/utils_spec.js b/test/utils/utils_spec.js index 14f2804a..d70f709f 100644 --- a/test/utils/utils_spec.js +++ b/test/utils/utils_spec.js @@ -1019,6 +1019,18 @@ describe("utils", function () { }); }); }); + describe('Context metadata to user variables', function (){ + it('should use context value as user variables', function(){ + const options = { + variables: [["$xpos", "ctx:!x_pos!_to_f"], ["$ypos", "ctx:!y_pos!_to_f"]], + crop: "crop", + x: "$xpos * w", + y: "$ypos * h" + } + expect(cloudinary.utils.generate_transformation_string(options)) + .to.contain('$xpos_ctx:!x_pos!_to_f,$ypos_ctx:!y_pos!_to_f,c_crop,x_$xpos_mul_w,y_$ypos_mul_h') + }); + }); describe('User Define Variables', function () { it("array should define a set of variables", function () { var options, t;