@capillarytech/creatives-library 7.12.118 → 7.12.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.12.118",
4
+ "version": "7.12.119",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -260,6 +260,9 @@ export const getCdnUrl = ({
260
260
  * @returns htmlContents with updated urls in image tag
261
261
  */
262
262
  export const updateImagesInHtml = (htmlContents) => {
263
+ if(!htmlContents || typeof htmlContents !== "string"){
264
+ return htmlContents;
265
+ }
263
266
  const copiedHtmlContents = htmlContents;
264
267
  try {
265
268
  const root = parse(htmlContents);
@@ -194,6 +194,12 @@ describe("cdnTransformationTests", () => {
194
194
  const expected = mockdata.emailRawTransformed;
195
195
  expect(htmlContentsOutput).toEqual(expected);
196
196
  });
197
+
198
+ it("should return input itself if input is either among undefined/null/empty string", () => {
199
+ expect(cdnUtils.updateImagesInHtml(undefined)).toEqual(undefined);
200
+ expect(cdnUtils.updateImagesInHtml(null)).toEqual(null);
201
+ expect(cdnUtils.updateImagesInHtml("")).toEqual("");
202
+ });
197
203
  });
198
204
 
199
205
  describe("transformEmailTemplate()", () => {