]> git.giacomolli.uk - onechat/blobdiff - whatsapp_fake_helper_test.go
Show the linked device as OneChat on the phone
[onechat] / whatsapp_fake_helper_test.go
index 3d7d117c0337967156eb096767ee15b06a27166f..ee5321ed4ab837ad9215d6fb9399e9c46c72452c 100644 (file)
@@ -352,3 +352,16 @@ func whatsappTestConnect(t *testing.T, fake *WhatsAppFake) {
        require.True(t, fake.Emit(&events.Connected{}))
        require.True(t, fake.Emit(&events.OfflineSyncCompleted{}))
 }
+
+// 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"))
+}