返回 DeepSeek-Reasonix
tool_search_test.go
根目录 / internal / provider / tool_search_test.go
1 package provider
2
3 import (
4 "context"
5 "testing"
6 )
7
8 func TestNativeToolSearchDefaultOffKeepsVisibleBytes(t *testing.T) {
9 visible := []ToolSchema{{Name: "use_capability", Description: "proxy", Parameters: []byte(`{"type":"object"}`)}}
10 extra := []ToolSchema{{Name: "mcp__s__t", Description: "t", Parameters: []byte(`{"type":"object"}`)}}
11 got := ApplyNativeToolSearch(visible, extra, nil)
12 if len(got) != 1 || got[0].Name != "use_capability" || got[0].Deferred {
13 t.Fatalf("preview off must keep fixed proxy only: %+v", got)
14 }
15 }
16
17 func TestNativeToolSearchUnsupportedProviders(t *testing.T) {
18 if NativeToolSearchSupported(namedProvider("openai")) {
19 t.Fatal("provider names must not imply protocol support")
20 }
21 }
22
23 type namedProvider string
24
25 func (p namedProvider) Name() string { return string(p) }
26 func (p namedProvider) Stream(context.Context, Request) (<-chan Chunk, error) { return nil, nil }
27
28 func TestNativeToolSearchPreviewMarksDeferred(t *testing.T) {
29 restore := SetNativeToolSearchPreviewForTest(true)
30 defer restore()
31 if NativeToolSearchEnabled(nil) {
32 t.Fatal("nil provider must stay disabled")
33 }
34 }
35
35 lines GO