]> git.giacomolli.uk - onechat/blobdiff - whatsapp_test.go
Keep the connection of a new WhatsApp link
[onechat] / whatsapp_test.go
index 0ba27146bfb62d35c1991c33c58a82cc6dbef6de..791e3ca9d41e7f80f001478fd51c2bf6f14dd588 100644 (file)
@@ -140,6 +140,14 @@ func TestWhatsAppPairsWithACode(t *testing.T) {
        items <- whatsmeow.QRChannelSuccess
        asking.WaitFor(t, "WhatsApp is linked to +15550001111.")
 
+       // The library connects again after the link with the context of the
+       // connection, so the end of the pairing must not end it.
+       connections := fake.Connections()
+       require.Len(t, connections, 1)
+       require.Never(t, func() bool {
+               return connections[0].Err() != nil
+       }, 200*time.Millisecond, time.Millisecond)
+
        require.Equal(t, []string{whatsappTestNumber}, fake.Phones())
        require.Equal(t, "WhatsApp is linked and not connected yet.", whatsapp.Status())
        require.Equal(t, "[connected to OneChat]\n", other.Output())