fixed #60
This commit is contained in:
@@ -18,7 +18,7 @@ func TestGetMonday(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFormatDuration(t *testing.T) {
|
||||
durations := []struct {
|
||||
testCases := []struct {
|
||||
name string
|
||||
duration time.Duration
|
||||
}{
|
||||
@@ -28,9 +28,9 @@ func TestFormatDuration(t *testing.T) {
|
||||
{"-1h 30min", time.Duration(-90 * time.Minute)},
|
||||
{"", 0},
|
||||
}
|
||||
for _, d := range durations {
|
||||
t.Run(d.name, func(t *testing.T) {
|
||||
if FormatDuration(d.duration) != d.name {
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if FormatDuration(tc.duration) != tc.name {
|
||||
t.Error("Format missmatch in Formatduration.")
|
||||
}
|
||||
})
|
||||
@@ -58,3 +58,27 @@ func TestGetWorkingDays(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestFormatGermanDayOfWeek(t *testing.T) {
|
||||
testCases := []struct {
|
||||
date string
|
||||
result string
|
||||
}{
|
||||
{"2025-12-01", "Mo"},
|
||||
{"2025-12-02", "Di"},
|
||||
{"2025-12-03", "Mi"},
|
||||
{"2025-12-04", "Do"},
|
||||
{"2025-12-05", "Fr"},
|
||||
{"2025-12-06", "Sa"},
|
||||
{"2025-12-07", "So"},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(fmt.Sprintf("FormatWeekDayTest: %s date", tc.date), func(t *testing.T) {
|
||||
date, _ := time.Parse(time.DateOnly, tc.date)
|
||||
if FormatGermanDayOfWeek(date) != tc.result {
|
||||
t.Error("Formatted workday did not match!")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user