Skip to content

Commit

Permalink
remove required for data (#1203)
Browse files Browse the repository at this point in the history
Co-authored-by: Nina Ciocanu <[email protected]>
  • Loading branch information
ninaceban and Nina Ciocanu authored Oct 29, 2024
1 parent 3f64390 commit 9474080
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
2 changes: 2 additions & 0 deletions src/components/Personalization/createApplyPropositions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ governing permissions and limitations under the License.

import { defer, isEmptyObject, isNonEmptyArray } from "../../utils/index.js";
import {
DEFAULT_CONTENT_ITEM,
DOM_ACTION,
HTML_CONTENT_ITEM,
JSON_CONTENT_ITEM,
Expand All @@ -29,6 +30,7 @@ const SUPPORTED_SCHEMAS = {
[HTML_CONTENT_ITEM]: () => true,
[JSON_CONTENT_ITEM]: isInteractionTrackingItem,
[MESSAGE_IN_APP]: () => true,
[DEFAULT_CONTENT_ITEM]: () => true,
};

const filterItemsPredicate = (schema, actionType) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default ({ logger, options }) => {
objectOf({
id: string().required(),
schema: string().required(),
data: anything().required(),
data: objectOf(anything()),
}),
)
.nonEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe("Personalization::createApplyPropositions", () => {
expect(processPropositions).toHaveBeenCalledOnceWith([]);
});

it("it should apply user-provided dom-action schema propositions", async () => {
it("it should apply user-provided dom-action/default-content schema propositions", async () => {
const expectedExecuteDecisionsPropositions = clone(
PAGE_WIDE_SCOPE_DECISIONS,
).map((proposition) => {
Expand All @@ -99,7 +99,7 @@ describe("Personalization::createApplyPropositions", () => {
expect(proposition.items).toEqual(
jasmine.arrayContaining([jasmine.any(Object)]),
);
expect(proposition.items.length).toEqual(2);
expect(proposition.items.length).toEqual(3);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ describe("Personalization::validateApplyPropositionsOptions", () => {
],
errorMessage:
"'propositions[0].items[0].id' is a required option\n" +
"'propositions[0].items[0].schema' is a required option\n" +
"'propositions[0].items[0].data' is a required option",
"'propositions[0].items[0].schema' is a required option",
},
{
propositions: [
Expand All @@ -188,20 +187,7 @@ describe("Personalization::validateApplyPropositionsOptions", () => {
items: [{ id: "abc" }],
},
],
errorMessage:
"'propositions[0].items[0].schema' is a required option\n" +
"'propositions[0].items[0].data' is a required option",
},
{
propositions: [
{
id: "abc",
scope: "web://aepdemo.com/",
scopeDetails,
items: [{ id: "abc", schema: DOM_ACTION }],
},
],
errorMessage: "'propositions[0].items[0].data' is a required option",
errorMessage: "'propositions[0].items[0].schema' is a required option",
},
];

Expand Down

0 comments on commit 9474080

Please sign in to comment.