Prevent stale approval buttons

This commit is contained in:
Codex
2026-05-24 03:23:58 +00:00
parent fd80780581
commit e85d0eb928
4 changed files with 91 additions and 9 deletions
+19
View File
@@ -84,6 +84,25 @@ func TestApprovalResponseForPermissions(t *testing.T) {
}
}
func TestEditReplyMarkupClearsInlineKeyboard(t *testing.T) {
markup := editReplyMarkup(nil)
if markup == nil {
t.Fatal("nil edit markup would leave Telegram buttons unchanged")
}
raw, err := json.Marshal(markup)
if err != nil {
t.Fatal(err)
}
if string(raw) != `{"inline_keyboard":[]}` {
t.Fatalf("clear markup JSON = %s", raw)
}
existing := approvalMarkup(7)
if editReplyMarkup(existing) != existing {
t.Fatal("non-nil markup should be preserved")
}
}
func TestParseCommand(t *testing.T) {
name, args, ok := parseCommand("/resume@my_bot 123")
if !ok || name != "resume" || len(args) != 1 || args[0] != "123" {