25 lines
979 B
Go
25 lines
979 B
Go
package tools
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"slackerbot/internal/acp"
|
|
)
|
|
|
|
func TestCallsCollectsCompletedSends(t *testing.T) {
|
|
var c Calls
|
|
in := json.RawMessage(`{"path":"/root/a.png","comment":"here"}`)
|
|
c.Update(acp.Update{Kind: "tool_call", ToolID: "1", ToolName: "slackerbot__send_file", RawInput: in})
|
|
c.Update(acp.Update{Kind: "tool_call", ToolID: "2", Title: "slackerbot: send file · /root/b.zip", RawInput: json.RawMessage(`{"path":"/root/b.zip"}`)})
|
|
c.Update(acp.Update{Kind: "tool_call", ToolID: "3", ToolName: "developer__shell", RawInput: json.RawMessage(`{"path":"/root/x"}`)})
|
|
c.Update(acp.Update{Kind: "tool_call_update", ToolID: "1", Status: "completed"})
|
|
c.Update(acp.Update{Kind: "tool_call_update", ToolID: "2", Status: "failed"})
|
|
c.Update(acp.Update{Kind: "tool_call_update", ToolID: "3", Status: "completed"})
|
|
|
|
got := c.Files()
|
|
if len(got) != 1 || got[0].Path != "/root/a.png" || got[0].Comment != "here" {
|
|
t.Fatalf("got %+v", got)
|
|
}
|
|
}
|