1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00
mxpv-podsync/pkg/model/timestamp_test.go

23 lines
380 B
Go
Raw Normal View History

2019-04-14 14:39:11 -07:00
package model
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestTimestamp_MarshalJSON(t *testing.T) {
time1 := Timestamp(time.Now())
data, err := time1.MarshalJSON()
assert.NoError(t, err)
time2 := Timestamp{}
err = time2.UnmarshalJSON(data)
assert.NoError(t, err)
assert.EqualValues(t, time.Time(time1).Unix(), time.Time(time2).Unix())
}