X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/6e7c7f3d47f086b9d59fe40b91fb071e1528684e..0b97bb2cc4bc0b8f8fe27cc7aa3f9d1d89ed28c8:/whatsapp_test.go?ds=sidebyside diff --git a/whatsapp_test.go b/whatsapp_test.go index 0ba2714..791e3ca 100644 --- a/whatsapp_test.go +++ b/whatsapp_test.go @@ -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())