v1 finished. Gonna build a dockerfile later
This commit is contained in:
29
main_test.go
Normal file
29
main_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestFormatDuration(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
seconds int
|
||||
expected string
|
||||
}{
|
||||
{"Nur Sekunden", 45, "0h 0m 45s"},
|
||||
{"Genau eine Minute", 60, "0h 1m 0s"},
|
||||
{"Stunden und Minuten", 3661, "1h 1m 1s"},
|
||||
{"Null Zeit", 0, "0h 0m 0s"},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
d := time.Duration(tt.seconds) * time.Second
|
||||
result := formatDuration(d)
|
||||
assert.Equal(t, tt.expected, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user