fix: route help and repeated-slash settings locally
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user