making use of the extended perms and added future work

This commit is contained in:
ari committed 2026-11-01 13:55:25 -05:00
1 parent 296e465f48
commit 22fd8fbce8
19 files changed
+617 -40

No files matched your search

@@ -152,3 +152,28 @@ func TestParseGrant(t *testing.T) {
t.Error("an unknown permission after a mention should be a usage error")
}
}
func TestParseListen(t *testing.T) {
cases := map[string]ListenCmd{
"": {},
"all-messages": {Mode: model.ListenAll},
"all-message": {Mode: model.ListenAll},
"Only-Mentions": {Mode: model.ListenMentions},
"channel all-messages": {Channel: true, Mode: model.ListenAll},
"default mentions": {Channel: true, Mode: model.ListenMentions},
"channel": {Channel: true},
}
for in, want := range cases {
if got, err := ParseListen(in); err != nil || got != want {
t.Fatalf("listen %q = %+v, %v; want %+v", in, got, err, want)
}
}
for _, in := range []string{"to me carefully", "all of it", "channel loudly"} {
if _, err := ParseListen(in); !errors.Is(err, ErrNotCommand) {
t.Fatalf("listen %q should go to the agent", in)
}
}
if !IsListen("/listen") || !IsListen("listen") || IsListen("/listening") {
t.Fatal("listen verb")
}
}