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

Function TestMaybeChatAskTurn_XMLKnowledgeLoop

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

Source from the content-addressed store, hash-verified

147}
148
149func TestMaybeChatAskTurn_XMLKnowledgeLoop(t *testing.T) {
150 t.Setenv(chatAskEnvVar, "false") // knowledge alone must still handle the turn
151 t.Setenv(chatKnowledgeEnvVar, "true")
152 cli := newKnowledgeTestCLI(t)
153 cli.animation = NewAnimationManager()
154 cli.animation.SetSuppressed(true)
155 plugins.SetKnowledgeAdapter(&knowledgePluginAdapter{cli: cli})
156 t.Cleanup(func() { plugins.SetKnowledgeAdapter(nil) })
157
158 fc := &knowledgeXMLFake{}
159 out, handled, err := cli.maybeChatAskTurn(context.Background(), fc, "como instalo?", "", nil, 500, SkillClientResolution{}, func() {})
160 if !handled || err != nil {
161 t.Fatalf("handled=%v err=%v", handled, err)
162 }
163 if out != "xml grounded answer" {
164 t.Fatalf("out = %q", out)
165 }
166}
167
168func TestMaybeChatAskTurn_BothDisabled(t *testing.T) {
169 t.Setenv(chatAskEnvVar, "false")

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