1
0
mirror of https://github.com/nxshock/gwp.git synced 2024-11-27 03:31:02 +05:00
gwp/durationformat_test.go

17 lines
441 B
Go
Raw Permalink Normal View History

2022-01-08 18:40:23 +05:00
package gwp
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestFmtDuration(t *testing.T) {
assert.Equal(t, " 1s", fmtDuration(time.Second))
assert.Equal(t, " 1m 0s", fmtDuration(time.Minute))
assert.Equal(t, " 1h 0s", fmtDuration(time.Hour))
assert.Equal(t, " 1d 0s", fmtDuration(time.Hour*24))
assert.Equal(t, "365d 0s", fmtDuration(time.Hour*24*365))
}