Files
Memoh/internal/models/http_client_test.go
Acbox e0fc2f514e fix(agent): surface tool calls before input completes
Emit tool-call placeholders as soon as tool input streaming starts so long writes appear immediately in chat. Reuse the same UI tool message when full input arrives to avoid duplicate cards, and keep the hook-required test suite green.
2026-04-16 16:42:07 +08:00

39 lines
972 B
Go

package models
import (
"net/http"
"testing"
"time"
)
func TestNewProviderHTTPClientWithoutTimeoutKeepsStreamingFriendlyBehavior(t *testing.T) {
client := NewProviderHTTPClient(0)
if client == nil {
t.Fatal("expected client")
return
}
if client.Timeout != 0 {
t.Fatalf("expected no client timeout, got %s", client.Timeout)
}
transport, ok := client.Transport.(*http.Transport)
if !ok {
t.Fatalf("expected *http.Transport, got %T", client.Transport)
}
if transport.TLSHandshakeTimeout < DefaultProviderTLSHandshakeTimeout {
t.Fatalf("expected TLS handshake timeout >= %s, got %s", DefaultProviderTLSHandshakeTimeout, transport.TLSHandshakeTimeout)
}
}
func TestNewProviderHTTPClientWithTimeout(t *testing.T) {
timeout := 45 * time.Second
client := NewProviderHTTPClient(timeout)
if client == nil {
t.Fatal("expected client")
return
}
if client.Timeout != timeout {
t.Fatalf("expected timeout %s, got %s", timeout, client.Timeout)
}
}