2021-10-18 13:48:04 +00:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
2023-11-07 19:48:43 +00:00
|
|
|
"google.golang.org/protobuf/proto"
|
2021-10-18 13:48:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetUnixEpochFrom(t *testing.T) {
|
|
|
|
loc := time.UTC
|
2021-11-05 20:09:48 +00:00
|
|
|
timestamp := GetUnixEpochFrom(time.Date(2019, 1, 1, 0, 0, 0, 0, loc))
|
2023-11-07 19:48:43 +00:00
|
|
|
require.Equal(t, proto.Int64(int64(1546300800*time.Second)), timestamp)
|
2021-11-10 09:46:11 +00:00
|
|
|
|
|
|
|
timestamp = GetUnixEpoch()
|
|
|
|
require.NotNil(t, timestamp)
|
2021-10-18 13:48:04 +00:00
|
|
|
}
|