mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-13 18:16:13 +00:00
feat(stock): add ratio dividend commands
This commit is contained in:
1 parent
6c934f6807
commit
8b2ac571d9
13 files changed
+1080
-51
No files matched your search
@@ -8,6 +8,8 @@ import (
|
||||
"github.com/go-telegram/bot/models"
|
||||
|
||||
"github.com/tiennm99/miti99bot/internal/modules"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/stock"
|
||||
"github.com/tiennm99/miti99bot/internal/storage"
|
||||
"github.com/tiennm99/miti99bot/internal/testutil"
|
||||
)
|
||||
|
||||
@@ -46,6 +48,28 @@ func TestBotCommandMenu_UsesLoadedPublicCommandsInModuleOrder(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBotCommandMenu_StockDividendContracts(t *testing.T) {
|
||||
mod := stock.New(modules.Deps{Store: storage.NewMemoryProvider().Collection("stock")})
|
||||
mod.Name = "stock"
|
||||
got := botCommandMenu(&modules.Registry{Modules: []modules.Module{mod}})
|
||||
|
||||
commands := make(map[string]string, len(got))
|
||||
for _, command := range got {
|
||||
commands[command.Command] = command.Description
|
||||
if len(command.Description) > 256 {
|
||||
t.Fatalf("description for %s exceeds Telegram limit", command.Command)
|
||||
}
|
||||
}
|
||||
for _, name := range []string{"stock_cash_dividend", "stock_share_dividend", "stock_dividend"} {
|
||||
if commands[name] == "" {
|
||||
t.Fatalf("stock menu missing %s: %v", name, commands)
|
||||
}
|
||||
}
|
||||
if _, exists := commands["stock_bonus"]; exists {
|
||||
t.Fatalf("stock_bonus remains in public menu: %v", commands)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegisterCommandMenu_CallsTelegramSetMyCommands(t *testing.T) {
|
||||
reg := &modules.Registry{
|
||||
Modules: []modules.Module{{
|
||||
|
||||
Reference in new issue
Block a user