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

Function TestBuildPendingApprovalEvent

internal/agent/webhooks_events_test.go:102–118  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func TestBuildPendingApprovalEvent(t *testing.T) {
103 a := &API{}
104 agent := &identity.AgentIdentity{ID: "bot@x.example.com", UserID: "u_1"}
105 expiry := time.Now().Add(1 * time.Hour)
106 msg := &identity.Message{ID: "pend_1", ApprovalExpiresAt: &expiry}
107 req := outbound.SendRequest{To: []string{"alice@example.com"}, Subject: "review me"}
108 ev := a.buildPendingApprovalEvent(agent, msg, req, "send")
109 if ev.Type != webhookpub.EventEmailPendingReview {
110 t.Errorf("Type = %q, want email.pending_review", ev.Type)
111 }
112 if ev.MessageID != "pend_1" {
113 t.Errorf("MessageID = %q, want pend_1", ev.MessageID)
114 }
115 if ev.UserID != "u_1" {
116 t.Errorf("UserID = %q", ev.UserID)
117 }
118}
119
120func TestBuildApprovedEvent(t *testing.T) {
121 a := &API{}

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected