bots-garden/mini-mepublic Fork
⑂ v1.0.3
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/mini-me.git
git clone ssh://git@rickub.com/bots-garden/mini-me.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
🛟 Updated. 6072b69 · on v1.0.3 · k33g · 10d ago
docs_assemble_test.go · 36 lines · 1.0 KBGo Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main

import (
	"context"
	"slices"
	"testing"

	"mm/internal/config"
	"mm/internal/detector"
	"mm/internal/engine"

	"github.com/firebase/genkit/go/genkit"
)

// search_docs is declared only with docSearch.autoSearchDocs; searchDocs alone
// (the /docs command) does not declare it.
func TestSearchDocsIsDeclaredOnlyWhenAsked(t *testing.T) {
	for _, c := range []struct {
		name string
		docs config.DocSearchConfig
		want bool
	}{
		{"default", config.DocSearchConfig{}, false},
		{"command only", config.DocSearchConfig{SearchDocs: true}, false},
		{"tool", config.DocSearchConfig{AutoSearchDocs: true}, true},
	} {
		t.Run(c.name, func(t *testing.T) {
			withConfig(t, func(cfg *config.Config) { cfg.DocSearch = c.docs })
			t.Setenv("MCP_GATEWAY_URL", "")
			set := assembleTools(&engine.Engine{G: genkit.Init(context.Background())}, detector.NewLoopDetector(10, 3), nil)
			if got := slices.Contains(set.names, "search_docs"); got != c.want {
				t.Errorf("search_docs declared = %v, want %v (names %v)", got, c.want, set.names)
			}
		})
	}
}