MCPcopy Create free account
hub / github.com/diillson/chatcli / TestMaybeChatAskTurn_NativeKnowledgeLoop

Function TestMaybeChatAskTurn_NativeKnowledgeLoop

cli/chat_knowledge_test.go:111–131  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestMaybeChatAskTurn_NativeKnowledgeLoop(t *testing.T) {
112 t.Setenv(chatAskEnvVar, "true")
113 t.Setenv(chatKnowledgeEnvVar, "true")
114 cli := newKnowledgeTestCLI(t)
115 cli.animation = NewAnimationManager()
116 cli.animation.SetSuppressed(true)
117 plugins.SetKnowledgeAdapter(&knowledgePluginAdapter{cli: cli})
118 t.Cleanup(func() { plugins.SetKnowledgeAdapter(nil) })
119
120 fc := &knowledgeToolFake{}
121 out, handled, err := cli.maybeChatAskTurn(context.Background(), fc, "como instalo?", "", nil, 500, SkillClientResolution{}, func() {})
122 if !handled || err != nil {
123 t.Fatalf("handled=%v err=%v", handled, err)
124 }
125 if out != "final grounded answer" {
126 t.Fatalf("out = %q", out)
127 }
128 if fc.calls != 2 {
129 t.Fatalf("expected decision + follow-up calls, got %d", fc.calls)
130 }
131}
132
133// knowledgeXMLFake drives the XML transport: first reply asks for a pull,
134// second returns prose.

Callers

nothing calls this directly

Calls 6

SetKnowledgeAdapterFunction · 0.92
newKnowledgeTestCLIFunction · 0.85
NewAnimationManagerFunction · 0.85
SetSuppressedMethod · 0.80
maybeChatAskTurnMethod · 0.80
CleanupMethod · 0.45

Tested by

no test coverage detected