Prevent stale approval buttons
This commit is contained in:
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user