Files
tiennm99bot/internal/modules/random/random_test.go
T
tiennm99 7008a57cf5 refactor!: rebrand miti99bot to tiennm99bot
BREAKING CHANGE: the Go module path is now github.com/tiennm99/tiennm99bot,
the default sticker pack is stickers_by_<bot username>, and the health body,
deploy DM, User-Agents and image names say tiennm99bot.
2026-10-07 15:14:02 +07:00

36 lines
930 B
Go

package random
import (
"testing"
"github.com/tiennm99/tiennm99bot/internal/modules"
"github.com/tiennm99/tiennm99bot/internal/storage"
)
func TestNew_RegistersRandomGroup(t *testing.T) {
mod := New(modules.Deps{Store: storage.NewMemoryProvider().Collection("random")})
want := map[string]modules.Visibility{
"random": modules.VisibilityPublic,
"wheelofnames": modules.VisibilityPublic,
"gacha": modules.VisibilityPublic,
"genshin": modules.VisibilityUnlisted,
}
if len(mod.Commands) != len(want) {
t.Fatalf("commands count = %d, want %d", len(mod.Commands), len(want))
}
for _, c := range mod.Commands {
v, ok := want[c.Name]
if !ok {
t.Errorf("unexpected command %q", c.Name)
continue
}
if c.Visibility != v {
t.Errorf("command %q visibility = %d, want %d", c.Name, c.Visibility, v)
}
if c.Handler == nil {
t.Errorf("command %q has nil handler", c.Name)
}
}
}