Skip to content

Commit 052564d

Browse files
nirmaozNir Maoz
authored andcommitted
Add test for custom function invocation
1 parent 1c045fe commit 052564d

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"webpack-cli": "^3.1.2"
5151
},
5252
"dependencies": {
53-
"cloudinary-core": "^2.6.2",
53+
"cloudinary-core": "^2.7.4",
5454
"prop-types": "^15.6.2"
5555
},
5656
"peerDependencies": {

test/ImageTest.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,30 @@ describe('Image', () => {
9898
expect(tag.state("url")).to.equal(`http://res.cloudinary.com/demo/image/upload/c_scale,w_${Math.ceil(containerWidth / 100) * 100}/sample`);
9999
});
100100
});
101-
});
101+
it('should support custom function remote', () => {
102+
const customFunction = {
103+
function_type: "remote",
104+
source: "https://df34ra4a.execute-api.us-west-2.amazonaws.com/default/cloudinaryFunction"
105+
};
106+
107+
let tag = mount(
108+
<Image publicId="sample" cloudName="demo"><Transformation customFunction={customFunction}/></Image>
109+
);
110+
111+
expect(tag.find('img').prop('src')).to.match(
112+
/fn_remote:aHR0cHM6Ly9kZjM0cmE0YS5leGVjdXRlLWFwaS51cy13ZXN0LTIuYW1hem9uYXdzLmNvbS9kZWZhdWx0L2Nsb3VkaW5hcnlGdW5jdGlvbg==\/sample/
113+
);
114+
});
115+
it('should support custom function wasm', () => {
116+
const customFunction = {
117+
function_type: "wasm",
118+
source: "blur.wasm"
119+
};
120+
121+
let tag = mount(
122+
<Image publicId="sample" cloudName="demo"><Transformation customFunction={customFunction}/></Image>
123+
);
124+
125+
expect(tag.find('img').prop('src')).to.match(/fn_wasm:blur.wasm\/sample/);
126+
});
127+
});

0 commit comments

Comments
 (0)