mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
23 lines
380 B
Go
23 lines
380 B
Go
|
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())
|
||
|
}
|