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)
| 55 | // + MIME-persistence behavior below has no /v1 unit home (httpapi tests use |
| 56 | // fakes), so it stays at the core level. |
| 57 | func 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. |
no test coverage detected