@capillarytech/creatives-library 8.0.75 → 8.0.76
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
package/utils/tagValidations.js
CHANGED
|
@@ -315,7 +315,7 @@ export const getTagMapValue = (object = {}) => {
|
|
|
315
315
|
return Object.values(
|
|
316
316
|
object
|
|
317
317
|
).reduce((acc, current) => {
|
|
318
|
-
return { ...acc
|
|
318
|
+
return { ...acc, ...current?.subtags ?? {} };
|
|
319
319
|
}, {});
|
|
320
320
|
};
|
|
321
321
|
|
|
@@ -498,6 +498,27 @@ describe("getTagMapValue", () => {
|
|
|
498
498
|
name: "233",
|
|
499
499
|
},
|
|
500
500
|
},
|
|
501
|
+
"key 2": {
|
|
502
|
+
name: "24",
|
|
503
|
+
subtags: {
|
|
504
|
+
tagName: "234",
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
};
|
|
508
|
+
const result = getTagMapValue(object);
|
|
509
|
+
expect(result).toEqual({ name: "233", tagName: "234", });
|
|
510
|
+
});
|
|
511
|
+
it("should return the tag map value when an object is provided but subtag is not present in one of the obj", () => {
|
|
512
|
+
const object = {
|
|
513
|
+
"key 1": {
|
|
514
|
+
name: "23",
|
|
515
|
+
subtags: {
|
|
516
|
+
name: "233",
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
"key 2": {
|
|
520
|
+
name: "24",
|
|
521
|
+
},
|
|
501
522
|
};
|
|
502
523
|
const result = getTagMapValue(object);
|
|
503
524
|
expect(result).toEqual({ name: "233" });
|