github.com/hamba/timex@v1.2.1-0.20240304044353-56d3de3a9ed9/time_test.go (about) 1 package timex_test 2 3 import ( 4 "testing" 5 "time" 6 7 "github.com/hamba/timex" 8 "github.com/stretchr/testify/assert" 9 ) 10 11 func TestSince(t *testing.T) { 12 then := timex.Now() - 1000 13 14 d := timex.Since(then) 15 16 assert.True(t, time.Duration(1000) <= d) 17 } 18 19 func TestUnix(t *testing.T) { 20 want := time.Now().Unix() 21 22 got := timex.Unix() 23 24 assert.Equal(t, want, got) 25 }