mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 03:11:01 -06:00
25 lines
440 B
Go
25 lines
440 B
Go
package events
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
type TestEvent struct {
|
|
Timestamp time.Time
|
|
}
|
|
|
|
func TestEventCreation(t *testing.T) {
|
|
e := TestEvent{
|
|
Timestamp: time.Unix(1231421123, 223),
|
|
}
|
|
|
|
wire, err := ToOnWriteEvent(&e)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, e.Timestamp.Unix(), wire.Timestamp.Unix())
|
|
assert.Equal(t, "TestEvent", wire.EventType)
|
|
}
|