v1 finished. Gonna build a dockerfile later

This commit is contained in:
2026-04-01 20:11:38 +02:00
parent f1b157038c
commit 87b3623e60
8 changed files with 343 additions and 0 deletions

29
main_test.go Normal file
View 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)
})
}
}