返回 DeepSeek-Reasonix
dispatch_partial_test.go
根目录 / internal / acp / dispatch_partial_test.go
1 package acp
2
3 import (
4 "testing"
5
6 "reasonix/internal/event"
7 )
8
9 // TestUpdateSinkSkipsPartialDispatch probes the ACP adapter against the early
10 // (Partial) ToolDispatch. The adapter's contract is one pending tool_call per
11 // call, carrying rawInput; the partial has no args, so without a skip the client
12 // gets two tool_call notifications, the first with empty input.
13 func TestUpdateSinkSkipsPartialDispatch(t *testing.T) {
14 fn := &fakeNotifier{}
15 sink := newUpdateSink(fn, "sess-1")
16
17 sink.Emit(event.Event{Kind: event.ToolDispatch, Tool: event.Tool{ID: "call-1", Name: "read_file", Partial: true}})
18 sink.Emit(event.Event{Kind: event.ToolDispatch, Tool: event.Tool{ID: "call-1", Name: "read_file", Args: `{"path":"a.go"}`}})
19 sink.Emit(event.Event{Kind: event.ToolDispatch, Tool: event.Tool{ID: "call-1", Name: "read_file", Args: `{"path":"a.go"}`, Refreshed: true}})
20
21 if got := len(fn.notifs); got != 1 {
22 t.Fatalf("want one tool_call notification, got %d", got)
23 }
24 }
25
25 lines GO