) {
type="target"
position={Position.Bottom}
id="TriggerBeliefs"
- style={{ left: '40%' }}
+ style={{ left: '40%' }}
rules={[
- allowOnlyConnectionsFromType(['basic_belief', "inferred_belief"]),
+ allowOnlyConnectionsFromType(['basic_belief']),
]}
/>
@@ -136,7 +136,7 @@ export function TriggerConnectionTarget(_thisNode: Node, _sourceNodeId: string)
const otherNode = nodes.find((x) => x.id === _sourceNodeId)
if (!otherNode) return;
- if (otherNode.type === 'basic_belief'|| otherNode.type ==='inferred_belief') {
+ if (otherNode.type === 'basic_belief' /* TODO: Add the option for an inferred belief */) {
data.condition = _sourceNodeId;
}
@@ -172,7 +172,7 @@ export function TriggerDisconnectionTarget(_thisNode: Node, _sourceNodeId: strin
const data = _thisNode.data as TriggerNodeData;
// remove if the target of disconnection was our condition
if (_sourceNodeId == data.condition) data.condition = undefined
-
+
data.plan = deleteGoalInPlanByID(structuredClone(data.plan) as Plan, _sourceNodeId)
}
diff --git a/test/pages/visProgPage/visualProgrammingUI/components/SaveLoadPanel.test.tsx b/test/pages/visProgPage/visualProgrammingUI/components/SaveLoadPanel.test.tsx
index 9d85323..65458c9 100644
--- a/test/pages/visProgPage/visualProgrammingUI/components/SaveLoadPanel.test.tsx
+++ b/test/pages/visProgPage/visualProgrammingUI/components/SaveLoadPanel.test.tsx
@@ -105,6 +105,8 @@ describe("SaveLoadPanel - combined tests", () => {
});
test("onLoad with invalid JSON does not update store", async () => {
+ const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
+
const file = new File(["not json"], "bad.json", { type: "application/json" });
file.text = jest.fn(() => Promise.resolve(`{"bad json`));
@@ -112,20 +114,19 @@ describe("SaveLoadPanel - combined tests", () => {
render();
const input = document.querySelector('input[type="file"]') as HTMLInputElement;
- expect(input).toBeTruthy();
-
- // Give some input
+
act(() => {
fireEvent.change(input, { target: { files: [file] } });
});
await waitFor(() => {
expect(window.alert).toHaveBeenCalledTimes(1);
-
const nodesAfter = useFlowStore.getState().nodes;
expect(nodesAfter).toHaveLength(0);
- expect(input.value).toBe("");
});
+
+ // Clean up the spy
+ consoleSpy.mockRestore();
});
test("onLoad resolves to null when no file is chosen (user cancels) and does not update store", async () => {