X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/f2e67d5579593e2d4f1cb2d9165b851c52a06715..a85d214071706753f358f0af23cfd525c28dbfe0:/whatsapp_test.go?ds=inline 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())