X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/33aa709aa4e59e05ada6940a1c055f5e5646a418..522d7fd117285e4e4ce3ea5ec9b5a1722521b681:/whatsapp_send_test.go diff --git a/whatsapp_send_test.go b/whatsapp_send_test.go index 51651b2..469912b 100644 --- a/whatsapp_send_test.go +++ b/whatsapp_send_test.go @@ -70,6 +70,7 @@ func TestWhatsAppSendToAGroup(t *testing.T) { func TestWhatsAppSendThatFails(t *testing.T) { whatsapp, fake := whatsappStartTestLinked(t) fake.sendErr = errors.New("server error for " + whatsappTestNumber) + daemonStartTestWithWhatsApp(t, newModelFake(t), nil, whatsapp) whatsappTestConnect(t, fake) @@ -170,6 +171,7 @@ func TestWhatsAppSendWhileDisconnected(t *testing.T) { require.EqualError(t, err, "WhatsApp is disconnected, so nothing was sent: try again later") require.True(t, fake.Emit(&events.Connected{})) + answer, err := whatsapp.Send(t.Context(), "keys", whatsappTestAna.String(), "hi") require.NoError(t, err) require.Equal(t, "Sent to +15550002222 at 12:05.", answer) @@ -186,10 +188,12 @@ func TestWhatsAppSendWithoutALink(t *testing.T) { func TestAgentSendsAWhatsAppMessage(t *testing.T) { whatsapp, fake := whatsappStartTestLinked(t) whatsappTestContacts(t, whatsapp) + server := newModelFake(t) server.reply = func(w http.ResponseWriter, call ModelFakeCall) { if call.number == 0 { modelWriteEvents(w, modelCompletedEvent([]any{modelFunctionCallItem("fc_1", "call_1", "whatsapp_send", `{"id":"keys","chat":"15550002222@s.whatsapp.net","text":"The keys are under the mat."}`)}, 100, 0, 5)) + return }