Add experiment logs to the monitoring page #48

Merged
0950726 merged 122 commits from feat/experiment-logs into dev 2026-01-28 10:16:00 +00:00
Showing only changes of commit 09e6287f9d - Show all commits

View File

@@ -105,6 +105,8 @@ describe("SaveLoadPanel - combined tests", () => {
}); });
test("onLoad with invalid JSON does not update store", async () => { 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" }); const file = new File(["not json"], "bad.json", { type: "application/json" });
file.text = jest.fn(() => Promise.resolve(`{"bad json`)); file.text = jest.fn(() => Promise.resolve(`{"bad json`));
@@ -112,20 +114,19 @@ describe("SaveLoadPanel - combined tests", () => {
render(<SaveLoadPanel />); render(<SaveLoadPanel />);
const input = document.querySelector('input[type="file"]') as HTMLInputElement; const input = document.querySelector('input[type="file"]') as HTMLInputElement;
expect(input).toBeTruthy();
// Give some input
act(() => { act(() => {
fireEvent.change(input, { target: { files: [file] } }); fireEvent.change(input, { target: { files: [file] } });
}); });
await waitFor(() => { await waitFor(() => {
expect(window.alert).toHaveBeenCalledTimes(1); expect(window.alert).toHaveBeenCalledTimes(1);
const nodesAfter = useFlowStore.getState().nodes; const nodesAfter = useFlowStore.getState().nodes;
expect(nodesAfter).toHaveLength(0); 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 () => { test("onLoad resolves to null when no file is chosen (user cancels) and does not update store", async () => {