Skip to content

Commit 19f6094

Browse files
committed
feat: update test cases
1 parent 485c092 commit 19f6094

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

__test__/entry.test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,25 @@ describe("Entry", () => {
99
let sendToParent: any;
1010

1111
beforeEach(() => {
12-
sendToParent = () => {};
12+
sendToParent = (action: string, dataObj: any) => {
13+
if (action === "setData") {
14+
// Check if this is a restricted field type
15+
if (dataObj.uid === "group.group.group" || dataObj.uid === "modular_blocks.0") {
16+
return Promise.resolve({
17+
data: {
18+
success: false,
19+
error: {
20+
message: "Cannot call set data for current field type",
21+
details: []
22+
}
23+
}
24+
});
25+
}
26+
// Default successful response for other setData calls
27+
return Promise.resolve({ data: { success: true } });
28+
}
29+
return Promise.resolve();
30+
};
1331
connection = { sendToParent };
1432

1533
emitter = {

__test__/field.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe("Field", () => {
1616
describe("Generic", () => {
1717
beforeEach(() => {
1818
sendToParent = function () {
19-
return Promise.resolve();
19+
return Promise.resolve({ data: { success: true } });
2020
};
2121

2222
connection = { sendToParent: sendToParent };

__test__/fieldModifierLocation/field.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe("Field", () => {
1616
describe("Generic", () => {
1717
beforeEach(() => {
1818
sendToParent = function () {
19-
return Promise.resolve();
19+
return Promise.resolve({ data: { success: true } });
2020
};
2121

2222
connection = { sendToParent: sendToParent };

0 commit comments

Comments
 (0)