+// whatsappTestContacts puts the contacts of the tests into the session of
+// whatsapp: Ana Souza, Joao Silva with an accent, a business, and the user.
+func whatsappTestContacts(t *testing.T, whatsapp *WhatsApp) {
+ t.Helper()
+
+ contacts := whatsapp.device.Contacts
+ require.NoError(t, contacts.PutContactName(t.Context(), whatsappTestAna, "Ana", "Ana Souza"))
+ require.NoError(t, contacts.PutContactName(t.Context(), types.NewJID("15550004444", types.DefaultUserServer), "João", "João Silva"))
+ _, _, err := contacts.PutBusinessName(t.Context(), types.NewJID("15550005555", types.DefaultUserServer), "Corner Bakery")
+ require.NoError(t, err)
+ require.NoError(t, contacts.PutContactName(t.Context(), whatsappTestOwn, "Me", "Me Souza"))
+}
+
+func TestWhatsAppSendSendsOnceForEachID(t *testing.T) {
+ whatsapp, fake := whatsappStartTestLinked(t)
+ whatsappTestContacts(t, whatsapp)
+ daemonStartTestWithWhatsApp(t, newModelFake(t), nil, whatsapp)
+ whatsappTestConnect(t, fake)
+
+ answer, err := whatsapp.Send(t.Context(), "keys", whatsappTestAna.String(), "The keys are under the mat.")
+ require.NoError(t, err)
+ require.Equal(t, "Sent to Ana Souza at 12:05.", answer)
+
+ answer, err = whatsapp.Send(t.Context(), "keys", whatsappTestAna.String(), "The keys are under the mat.")
+ require.NoError(t, err)
+ require.Equal(t, "Sent to Ana Souza at 12:05. This is the answer of the first call with this id: nothing was sent again.", answer)
+
+ _, err = whatsapp.Send(t.Context(), "keys", whatsappTestAna.String(), "Another text.")
+ require.EqualError(t, err, "the id keys belongs to another message: give a new id for each message")
+
+ require.Equal(t, []WhatsAppFakeSend{