github.com/blend/go-sdk@v1.20220411.3/protoutil/timestamp_test.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package protoutil 9 10 import ( 11 "testing" 12 "time" 13 14 "github.com/blend/go-sdk/assert" 15 ) 16 17 func Test_Timestamp(t *testing.T) { 18 its := assert.New(t) 19 20 timestamp := time.Now().UTC() 21 22 its.Equal(timestamp, FromTimestamp(Timestamp(timestamp))) 23 24 // timestamp handles zero inputs 25 its.Nil(Timestamp(time.Time{})) 26 27 // from timestamp handles nil 28 its.True(FromTimestamp(nil).IsZero()) 29 }