7 "github.com/stretchr/testify/require"
10 func TestWhatsAppBatchText(t *testing.T) {
11 at := time.Date(2026, 1, 1, 12, 0, 0, 0, time.UTC)
12 testCases := []struct {
18 name: "a private chat with a message of another person starts a turn",
20 Chat: whatsappTestChat,
21 Messages: []WhatsAppMessage{
25 Text: "Are you at home?",
28 Time: at.Add(3 * time.Minute),
34 text: "[WhatsApp] Ana Souza, private chat 15550002222@s.whatsapp.net, Thursday 2026-01-01\n12:00 Ana Souza: Are you at home?\n12:03 You: Yes\n" + whatsappBatchEmptyReply,
37 name: "a private chat with messages of the user only starts no turn",
39 Chat: whatsappTestChat,
40 Messages: []WhatsAppMessage{
48 text: "[WhatsApp] Ana Souza, private chat 15550002222@s.whatsapp.net, Thursday 2026-01-01\n12:00 You: On my way.",
51 name: "a group with no mention of the user starts no turn",
53 Chat: whatsappTestGroup,
54 Messages: []WhatsAppMessage{
58 Text: "Who brings the cake?",
62 text: "[WhatsApp] Family, group 120363000000000001@g.us, Thursday 2026-01-01\n12:00 Bruno Lima: Who brings the cake?",
65 name: "a group with a mention of the user starts a turn",
67 Chat: whatsappTestGroup,
68 Messages: []WhatsAppMessage{
72 Text: "@you can you bring the cake?",
77 text: "[WhatsApp] Family, group 120363000000000001@g.us, Thursday 2026-01-01\n12:00 Bruno Lima (mentions you): @you can you bring the cake?\n" + whatsappBatchEmptyReply,
80 name: "a group with a reply to the user starts a turn",
82 Chat: whatsappTestGroup,
83 Messages: []WhatsAppMessage{
92 text: "[WhatsApp] Family, group 120363000000000001@g.us, Thursday 2026-01-01\n12:00 Bruno Lima (replies to you): Thanks!\n" + whatsappBatchEmptyReply,
96 for _, tc := range testCases {
97 t.Run(tc.name, func(t *testing.T) {
98 require.Equal(t, tc.text, tc.batch.Text(time.UTC))