mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-11 03:13:46 +00:00
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.
36 lines
930 B
Go
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)
|
|
}
|
|
}
|
|
}
|