MCPcopy
hub / github.com/caddyserver/caddy / TestEvent_CloudEvent_NilOrigin

Function TestEvent_CloudEvent_NilOrigin

caddy_test.go:77–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

75}
76
77func TestEvent_CloudEvent_NilOrigin(t *testing.T) {
78 ctx, _ := NewContext(Context{Context: context.Background()}) // module will be nil by default
79 event, err := NewEvent(ctx, "started", nil)
80 if err != nil {
81 t.Fatalf("NewEvent() error = %v", err)
82 }
83
84 // This should not panic
85 ce := event.CloudEvent()
86
87 if ce.Source != "caddy" {
88 t.Errorf("Expected CloudEvent Source to be 'caddy', got '%s'", ce.Source)
89 }
90 if ce.Type != "started" {
91 t.Errorf("Expected CloudEvent Type to be 'started', got '%s'", ce.Type)
92 }
93}

Callers

nothing calls this directly

Calls 3

CloudEventMethod · 0.95
NewContextFunction · 0.85
NewEventFunction · 0.85

Tested by

no test coverage detected