]> git.giacomolli.uk - onechat/blobdiff - telegram_test.go
Separate multiline Go statements
[onechat] / telegram_test.go
index 84f41c80c50894cbcd8da6e0ad2f2be3b2f56315..8d033ab3aa62cd33ed408fe4835aef17fb301eb7 100644 (file)
@@ -145,7 +145,8 @@ func TestBotShowsOnlyTheStartAndTheEndOfASubagent(t *testing.T) {
                last := subagentTestLastItem(call)
                switch {
                case subagentTestCall(call):
-                       // The report comes after the reply of the turn of the spawn.
+                       // The report comes after the reply of the turn of the
+                       // spawn.
                        require.Eventually(t, func() bool {
                                return slices.Contains(telegram.Sent(), "Started.")
                        }, 10*time.Second, time.Millisecond)
@@ -191,11 +192,13 @@ func TestBotSkipsTheWorkOfWhatsAppAndTheSchedules(t *testing.T) {
                Source: whatsappSource,
                Text:   "[WhatsApp] Ana Souza",
        })
+
        bot.Notify(Event{
                Kind:   "work",
                Source: scheduleSource,
                Text:   "[Schedule 1] Sunday 2026-11-08 20:05 -03:00, once",
        })
+
        require.Empty(t, bot.queue)
 }
 
@@ -271,8 +274,8 @@ func TestBotTriesAgainAfterFailures(t *testing.T) {
        require.Contains(t, logs.String(), "<6>receive back after=")
        require.Contains(t, logs.String(), "<4>send failed retry=1s: 429")
 
-       // The bot logs the end of the outage after the send returns, so the line
-       // can come after the fake server has the message.
+       // The bot logs the end of the outage after the send returns, so the
+       // line can come after the fake server has the message.
        require.Eventually(t, func() bool {
                return strings.Contains(logs.String(), "<6>send back after=")
        }, 10*time.Second, time.Millisecond)
@@ -645,6 +648,7 @@ func TestBotLogsNoTokenWhenTheNetworkFails(t *testing.T) {
        require.Eventually(t, func() bool {
                return strings.Contains(logs.String(), "<4>receive failed retry=1s: no answer: ")
        }, 10*time.Second, time.Millisecond)
+
        require.NotContains(t, logs.String(), telegramTestToken)
 }
 
@@ -693,6 +697,7 @@ func TestBotLogsAnOutageOnlyAtItsStartAndEnd(t *testing.T) {
                        "<4>receive failed retry=1s: 502 Bad Gateway",
                        "<6>receive back after=31s",
                }, lines)
+
                require.NotContains(t, logs.String(), "secret word")
                require.NotContains(t, logs.String(), strconv.FormatInt(telegramTestOwner, 10))
                cancel()