MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestCreateOutboundMessage

Function TestCreateOutboundMessage

internal/identity/store_test.go:569–597  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

567}
568
569func TestCreateOutboundMessage(t *testing.T) {
570 pool := testutil.TestDB(t)
571 store := identity.NewStore(pool)
572 ctx := context.Background()
573
574 user, _ := store.CreateOrGetUser(ctx, "owner@example.com", "Owner", "google-outbound")
575 store.ClaimOrCreateDomain(ctx, "outbound.example.com", user.ID)
576 a, _ := store.CreateAgent(ctx, "agent@outbound.example.com", "outbound.example.com", "", "https://example.com/webhook", "", user.ID)
577
578 msg, err := store.CreateOutboundMessage(ctx, a.ID, []string{"alice@gmail.com"}, nil, nil, "Re: Hello", "reply", "smtp", "", "", nil)
579 if err != nil {
580 t.Fatalf("CreateOutboundMessage: %v", err)
581 }
582 if msg.Direction != "outbound" {
583 t.Errorf("Direction = %q, want outbound", msg.Direction)
584 }
585 if msg.Method != "smtp" {
586 t.Errorf("Method = %q", msg.Method)
587 }
588 if msg.Type != "reply" {
589 t.Errorf("Type = %q", msg.Type)
590 }
591 if msg.Recipient != "alice@gmail.com" {
592 t.Errorf("Recipient = %q, want alice@gmail.com", msg.Recipient)
593 }
594 if len(msg.ToRecipients) != 1 || msg.ToRecipients[0] != "alice@gmail.com" {
595 t.Errorf("ToRecipients = %v, want [alice@gmail.com]", msg.ToRecipients)
596 }
597}
598
599func TestListActivityByAgent(t *testing.T) {
600 pool := testutil.TestDB(t)

Callers

nothing calls this directly

Calls 6

CreateOrGetUserMethod · 0.95
ClaimOrCreateDomainMethod · 0.95
CreateAgentMethod · 0.95
CreateOutboundMessageMethod · 0.95
TestDBFunction · 0.92
NewStoreFunction · 0.92

Tested by

no test coverage detected