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

Function TestGetInboundMessageExpired

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

Source from the content-addressed store, hash-verified

526}
527
528func TestGetInboundMessageExpired(t *testing.T) {
529 pool := testutil.TestDB(t)
530 store := identity.NewStore(pool)
531 ctx := context.Background()
532
533 user, _ := store.CreateOrGetUser(ctx, "owner@example.com", "Owner", "google-expired-inbound")
534 store.ClaimOrCreateDomain(ctx, "expired-inbound.example.com", user.ID)
535 a, _ := store.CreateAgent(ctx, "agent@expired-inbound.example.com", "expired-inbound.example.com", "", "https://example.com/webhook", "", user.ID)
536 msg, _ := store.CreateInboundMessage(ctx, "", a.ID, "alice@gmail.com", "bot@expired-inbound.example.com", "", "", "", "", nil, nil, nil, false, "", nil, nil, nil, identity.InboundScreening{})
537
538 // Set expiry to the past
539 pool.Exec(ctx, `UPDATE messages SET expires_at = $1 WHERE id = $2`, time.Now().Add(-1*time.Hour), msg.ID)
540
541 _, err := store.GetInboundMessage(ctx, msg.ID)
542 if err == nil {
543 t.Error("expected error for expired inbound message")
544 }
545}
546
547func TestDeleteExpiredMessages(t *testing.T) {
548 pool := testutil.TestDB(t)

Callers

nothing calls this directly

Calls 9

CreateOrGetUserMethod · 0.95
ClaimOrCreateDomainMethod · 0.95
CreateAgentMethod · 0.95
CreateInboundMessageMethod · 0.95
GetInboundMessageMethod · 0.95
TestDBFunction · 0.92
NewStoreFunction · 0.92
ExecMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected