fix: route help and repeated-slash settings locally

This commit is contained in:
姚章浩
2026-08-13 14:39:56 +08:00
parent 44d9398c78
commit 0f30f8cec8
4 changed files with 25 additions and 2 deletions
+17
View File
@@ -80,6 +80,23 @@ func TestControllerBindsAdminSupportGroup(t *testing.T) {
t.Fatalf("binding=%+v", r.bindings)
}
}
func TestControllerHelpIsHandledLocally(t *testing.T) {
r := newMemoryRepo()
c := NewController(r)
if !c.ShouldHandle(context.Background(), "t", "u", "/help") {
t.Fatal("help must be intercepted before QA")
}
out, err := c.Handle(context.Background(), SettingInput{TenantKey: "t", StaffID: "u", Text: "/help", ConversationType: "direct"})
if err != nil {
t.Fatal(err)
}
for _, want := range []string{"普通提问", "/setting", "/help"} {
if !strings.Contains(out, want) {
t.Fatalf("help=%q missing %q", out, want)
}
}
}
func TestControllerParsesAdminQuestionTable(t *testing.T) {
r := newMemoryRepo()
r.admins["t/a"] = true