Skip to content

Commit ca51efe

Browse files
phernandezclaude
andcommitted
fix: update test to match fall-through-on-any-error behavior
The indexConversation method now falls through to writeNote on any editNote error, not just not-found errors. Updated test to expect writeNote to be called on validation errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a87a658 commit ca51efe

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

bm-client.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,18 +523,23 @@ describe("BmClient MCP behavior", () => {
523523
expect(result.file_path).toBe("archive/my-note.md")
524524
})
525525

526-
it("indexConversation does not create fallback note on non-not-found edit errors", async () => {
526+
it("indexConversation falls through to writeNote on any editNote error", async () => {
527527
;(client as any).editNote = jest
528528
.fn()
529529
.mockRejectedValue(new Error("validation failed"))
530-
;(client as any).writeNote = jest.fn()
530+
;(client as any).writeNote = jest.fn().mockResolvedValue({
531+
title: "conversations",
532+
permalink: "conversations",
533+
content: "x",
534+
file_path: "conversations/x.md",
535+
})
531536

532537
await client.indexConversation(
533538
"user message long enough",
534539
"assistant reply long enough",
535540
)
536541

537-
expect((client as any).writeNote).not.toHaveBeenCalled()
542+
expect((client as any).writeNote).toHaveBeenCalledTimes(1)
538543
})
539544

540545
it("indexConversation creates fallback note only on note-not-found errors", async () => {

0 commit comments

Comments
 (0)