require.NotContains(t, logs.String(), testBotToken)
}
+func TestDeliverTriesAgainAfterATimeout(t *testing.T) {
+ telegram := newFakeBot(t)
+ stalls := 1
+ telegram.stall = func(call fakeBotCall) bool {
+ if call.method != "sendMessage" || stalls == 0 {
+ return false
+ }
+
+ stalls--
+
+ return true
+ }
+
+ bot, logs := startTestBot(t, telegram)
+ bot.api.sendTimeout = 50 * time.Millisecond
+ bot.deliver(t.Context(), "hello")
+
+ require.Equal(t, []string{"hello"}, telegram.Sent())
+ require.Len(t, telegram.Calls(), 2)
+ require.Contains(t, logs.String(), "no valid answer")
+ require.NotContains(t, logs.String(), testBotToken)
+}
+
func TestBotLogsNoTokenWhenTheNetworkFails(t *testing.T) {
telegram := newFakeBot(t)
telegram.Close()