(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestDurationDisplay(t *testing.T) { |
| 12 | t.Parallel() |
| 13 | for _, testCase := range []struct { |
| 14 | Duration string |
| 15 | Expected string |
| 16 | }{ |
| 17 | {"-1s", "<1m"}, |
| 18 | {"0s", "0s"}, |
| 19 | {"1s", "<1m"}, |
| 20 | {"59s", "<1m"}, |
| 21 | {"1m", "1m"}, |
| 22 | {"1m1s", "1m"}, |
| 23 | {"2m", "2m"}, |
| 24 | {"59m", "59m"}, |
| 25 | {"1h", "1h"}, |
| 26 | {"1h1m1s", "1h1m"}, |
| 27 | {"2h", "2h"}, |
| 28 | {"23h", "23h"}, |
| 29 | {"24h", "1d"}, |
| 30 | {"24h1m1s", "1d"}, |
| 31 | {"25h", "1d1h"}, |
| 32 | } { |
| 33 | t.Run(testCase.Duration, func(t *testing.T) { |
| 34 | t.Parallel() |
| 35 | d, err := time.ParseDuration(testCase.Duration) |
| 36 | require.NoError(t, err) |
| 37 | actual := durationDisplay(d) |
| 38 | assert.Equal(t, testCase.Expected, actual) |
| 39 | }) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | func TestExtendedParseDuration(t *testing.T) { |
| 44 | t.Parallel() |
nothing calls this directly
no test coverage detected