MCPcopy Create free account
hub / github.com/auth0/auth0-cli / TestNewEvent

Function TestNewEvent

internal/analytics/analytics_test.go:57–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

55}
56
57func TestNewEvent(t *testing.T) {
58 t.Run("creates a new event instance", func(t *testing.T) {
59 event := newEvent("event", "id", nil)
60 // Assert that the interval between the event timestamp and now is within 1 second.
61 assert.WithinDuration(t, time.Now(), time.Unix(0, event.Timestamp*int64(1000000)), 1*time.Second)
62 assert.Equal(t, event.App, appID)
63 assert.Equal(t, event.Event, "event")
64 assert.Equal(t, event.ID, "id")
65 assert.Equal(t, event.Properties[osKey], runtime.GOOS)
66 assert.Equal(t, event.Properties[archKey], runtime.GOARCH)
67 })
68
69 t.Run("merges extra properties", func(t *testing.T) {
70 event := newEvent("event", "id", map[string]string{"success": "false", "error_class": "auth"})
71 assert.Equal(t, "false", event.Properties["success"])
72 assert.Equal(t, "auth", event.Properties["error_class"])
73 assert.Equal(t, runtime.GOOS, event.Properties[osKey])
74 })
75}

Callers

nothing calls this directly

Calls 1

newEventFunction · 0.85

Tested by

no test coverage detected