2015-02-04 08:37:26 -06:00
|
|
|
package events
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2015-02-04 09:57:20 -06:00
|
|
|
"time"
|
2015-02-04 08:37:26 -06:00
|
|
|
|
2020-08-13 04:10:48 -05:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
2015-02-04 08:37:26 -06:00
|
|
|
)
|
|
|
|
|
2015-02-04 09:57:20 -06:00
|
|
|
type TestEvent struct {
|
|
|
|
Timestamp time.Time
|
|
|
|
}
|
|
|
|
|
2015-02-04 08:37:26 -06:00
|
|
|
func TestEventCreation(t *testing.T) {
|
2020-08-13 04:10:48 -05:00
|
|
|
e := TestEvent{
|
|
|
|
Timestamp: time.Unix(1231421123, 223),
|
|
|
|
}
|
2015-02-04 09:57:20 -06:00
|
|
|
|
2020-08-13 04:10:48 -05:00
|
|
|
wire, err := ToOnWriteEvent(&e)
|
|
|
|
require.NoError(t, err)
|
|
|
|
assert.Equal(t, e.Timestamp.Unix(), wire.Timestamp.Unix())
|
|
|
|
assert.Equal(t, "TestEvent", wire.EventType)
|
2015-02-04 08:37:26 -06:00
|
|
|
}
|