X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/48d7bce28b18ecef4c52c98821675605464cecb9..bd7da3557dc7a17020931f5a49ed5007fa81a645:/whatsapp_inbox_test.go?ds=inline diff --git a/whatsapp_inbox_test.go b/whatsapp_inbox_test.go index a0a0f9d..c086e07 100644 --- a/whatsapp_inbox_test.go +++ b/whatsapp_inbox_test.go @@ -57,13 +57,13 @@ func TestWhatsAppGroupTurns(t *testing.T) { turn bool }{ { - name: "plain", + name: "keeps plain group text without starting a turn", message: func(_ *events.Message) { }, line: "12:00 Bruno Lima: Who brings the cake?", }, { - name: "mention", + name: "starts a turn for a mention of the user", message: func(event *events.Message) { event.Message = &waE2E.Message{ ExtendedTextMessage: &waE2E.ExtendedTextMessage{ @@ -78,7 +78,7 @@ func TestWhatsAppGroupTurns(t *testing.T) { turn: true, }, { - name: "reply", + name: "starts a turn for a reply to the user", message: func(event *events.Message) { event.Message = &waE2E.Message{ ExtendedTextMessage: &waE2E.ExtendedTextMessage{ @@ -147,7 +147,7 @@ func TestWhatsAppRunClosesABatchAfterQuietTime(t *testing.T) { synctest.Wait() require.True(t, test.fake.Emit(whatsappTestMessage(whatsappTestAna, whatsappTestOwn, "m1", "On my way.", time.Now()))) synctest.Wait() - time.Sleep(whatsappBatchQuiet - time.Nanosecond) + time.Sleep(whatsappBatchIdleTimeout - time.Nanosecond) synctest.Wait() require.Zero(t, test.loop.memory.Len()) @@ -165,43 +165,43 @@ func TestWhatsAppSkipsExcludedMessages(t *testing.T) { change func(event *events.Message) }{ { - name: "an edit", + name: "ignores an edit", change: func(event *events.Message) { event.IsEdit = true }, }, { - name: "old history", + name: "ignores old history", change: func(event *events.Message) { event.SourceWebMsg = &waWeb.WebMessageInfo{} }, }, { - name: "a view-once message", + name: "ignores a view-once message", change: func(event *events.Message) { event.IsViewOnce = true }, }, { - name: "a disappearing message", + name: "ignores a disappearing message", change: func(event *events.Message) { event.IsEphemeral = true }, }, { - name: "the chat of the user with itself", + name: "ignores the chat of the user with itself", change: func(event *events.Message) { event.Info.Chat = whatsappTestOwn }, }, { - name: "a status broadcast", + name: "ignores a status broadcast", change: func(event *events.Message) { event.Info.Chat = types.StatusBroadcastJID }, }, { - name: "a text of spaces", + name: "ignores a text of spaces", change: func(event *events.Message) { event.Message.Conversation = new(" ") }, @@ -268,7 +268,7 @@ func TestWhatsAppCatchupEndsAfterItsLimit(t *testing.T) { require.NoError(t, test.whatsapp.inbox.deliver(t.Context(), test.loop, test.whatsapp.link(), false)) require.Zero(t, test.loop.memory.Len()) - time.Sleep(whatsappCatchupLimit) + time.Sleep(whatsappCatchupTimeout) synctest.Wait() require.NoError(t, test.whatsapp.inbox.deliver(t.Context(), test.loop, test.whatsapp.link(), false)) require.Equal(t, 1, test.loop.memory.Len())