(new): rich message support
(fix): runtime reliability (tests): regression coverage (doc): v1.1 release notes
This commit is contained in:
@@ -73,6 +73,35 @@ func TestInlineKeyboardButtonBuilderSetCallbackDataUsesConfiguredPayloadType(t *
|
||||
}
|
||||
}
|
||||
|
||||
func TestInlineKeyboardButtonBuilderKeepsExactlyOneAction(t *testing.T) {
|
||||
callback := NewInlineKeyboardButton("Action").
|
||||
SetURL("https://example.test").
|
||||
SetCallbackDataJSON("confirm").
|
||||
build()
|
||||
if callback.URL != "" || callback.CallbackData == "" {
|
||||
t.Fatalf("callback action was not exclusive: %#v", callback)
|
||||
}
|
||||
|
||||
link := NewInlineKeyboardButton("Action").
|
||||
SetCallbackDataJSON("confirm").
|
||||
SetURL("https://example.test").
|
||||
build()
|
||||
if link.URL == "" || link.CallbackData != "" {
|
||||
t.Fatalf("URL action was not exclusive: %#v", link)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInlineKeyboardGetReturnsIndependentMarkup(t *testing.T) {
|
||||
keyboard := NewInlineKeyboardJSON(1).AddURLButton("Docs", "https://example.test")
|
||||
first := keyboard.Get()
|
||||
first.InlineKeyboard[0][0].Text = "mutated"
|
||||
|
||||
second := keyboard.Get()
|
||||
if got := second.InlineKeyboard[0][0].Text; got != "Docs" {
|
||||
t.Fatalf("Get exposed builder state for mutation: got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInlineKeyboardGetPayloadTypeReturnsLocalOverride(t *testing.T) {
|
||||
kb := NewInlineKeyboardJSON(2)
|
||||
if got := kb.GetPayloadType(); got != BotPayloadJSON {
|
||||
|
||||
Reference in New Issue
Block a user