package errorrecord import ( "testing" "time" "git.toki-labs.com/toki/ariadne/internal/domain/organization" "github.com/google/uuid" ) func TestEventValidate(t *testing.T) { t.Parallel() event := Event{ SchemaVersion: SchemaVersionV1, EventID: "event-1", OrganizationID: organization.NewID(), ProjectID: uuid.NewString(), IngestionSourceID: uuid.NewString(), OccurredAt: time.Now(), Source: Source{ System: "payments", Service: "checkout", Environment: "production", }, Error: ErrorDetail{ Type: "TimeoutError", Message: "upstream request timed out", }, } if err := event.Validate(); err != nil { t.Fatalf("Validate() error = %v", err) } } func TestEventValidateRequiresTenantScope(t *testing.T) { t.Parallel() event := Event{ SchemaVersion: SchemaVersionV1, EventID: "event-1", ProjectID: uuid.NewString(), IngestionSourceID: uuid.NewString(), OccurredAt: time.Now(), Source: Source{ System: "payments", Service: "checkout", Environment: "production", }, Error: ErrorDetail{ Type: "TimeoutError", Message: "upstream request timed out", }, } if err := event.Validate(); err == nil { t.Fatal("Validate() expected an organization scope error") } }