test(KB-082): complete Step 6 — Add/update tests for error field and retry

This commit is contained in:
gsxdsm
2026-03-29 21:44:44 -07:00
parent b3af346345
commit 81cf41ba50
6 changed files with 597 additions and 2 deletions

View File

@@ -154,7 +154,7 @@ describe("TaskExecutor with semaphore", () => {
expect(onError).toHaveBeenCalled();
});
it("sets task status to 'failed' when execution throws", async () => {
it("sets task status to 'failed' with error message when execution throws", async () => {
const store = createMockStore();
mockedCreateHaiAgent.mockRejectedValue(new Error("agent crashed"));
@@ -175,7 +175,7 @@ describe("TaskExecutor with semaphore", () => {
updatedAt: new Date().toISOString(),
});
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed" });
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed", error: "agent crashed" });
expect(onError).toHaveBeenCalled();
});