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

Function setupCoreAPI

internal/agent/selfsend_test.go:57–66  ·  view source on GitHub ↗

setupCoreAPI builds an *agent.API wired to a real test DB so tests can drive the extracted outbound core (DeliverOutbound) directly. The legacy POST /api/v1/send route these self-send tests once rode through was removed in the v1 cutover; the loopback core it called lives on (and is what /v1's sendM

(t *testing.T)

Source from the content-addressed store, hash-verified

55// + MIME-persistence behavior below has no /v1 unit home (httpapi tests use
56// fakes), so it stays at the core level.
57func setupCoreAPI(t *testing.T) (*agent.API, *identity.Store, *pgxpool.Pool) {
58 t.Helper()
59 pool := testutil.TestDB(t)
60 store := identity.NewStore(pool)
61 smtpRelay := outbound.NewSMTPRelay(&config.OutboundSMTPConfig{})
62 sender := outbound.NewSender(smtpRelay, "test.e2a.dev")
63 api := agent.NewAPI(store, sender, smtpRelay, nil, usage.NewNoopUsageTracker(),
64 "e2a.dev", "test.e2a.dev", "agents.e2a.dev", "", false)
65 return api, store, pool
66}
67
68// selfAgent provisions a verified domain + agent owned by a fresh user and
69// returns the user and the loaded agent identity ready for DeliverOutbound.

Calls 6

TestDBFunction · 0.92
NewStoreFunction · 0.92
NewSMTPRelayFunction · 0.92
NewSenderFunction · 0.92
NewAPIFunction · 0.92
NewNoopUsageTrackerFunction · 0.92

Tested by

no test coverage detected