Files
Laniakea/handler_test.go

15 lines
404 B
Go

package laniakea
import "testing"
func TestCheckPrefixesSkipsEmptyPrefixes(t *testing.T) {
bot := &Bot[NoDB]{prefixes: []string{"", "/"}}
if prefix, ok := bot.checkPrefixes("hello"); ok {
t.Fatalf("unexpected prefix match for plain text: %q", prefix)
}
if prefix, ok := bot.checkPrefixes("/start"); !ok || prefix != "/" {
t.Fatalf("unexpected prefix result: prefix=%q ok=%v", prefix, ok)
}
}