util_test.go 548 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package util
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestUtil_ConvertParseLocalUnix(t *testing.T) {
  7. type args struct {
  8. unix int64
  9. }
  10. tests := []struct {
  11. Name string
  12. Args args
  13. }{
  14. {
  15. Name: "08:00:00",
  16. Args: args{
  17. unix: 1727049600,
  18. },
  19. },
  20. {
  21. Name: "09:00:00",
  22. Args: args{
  23. unix: 1727053200,
  24. },
  25. },
  26. }
  27. for _, tt := range tests {
  28. t.Run(tt.Name, func(t *testing.T) {
  29. got, err := ConvertParseLocalUnix(tt.Name)
  30. assert.Nil(t, err)
  31. assert.Equal(t, tt.Args.unix, got)
  32. })
  33. }
  34. }