18 lines
389 B
Go
18 lines
389 B
Go
package helper
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestGetMonday(t *testing.T) {
|
|
isMonday, err := time.Parse("2006-01-02", "2025-07-14")
|
|
notMonday, err := time.Parse("2006-01-02", "2025-07-16")
|
|
if err != nil || isMonday == notMonday {
|
|
t.Errorf("U stupid? %e", err)
|
|
}
|
|
if GetMonday(isMonday) != isMonday || GetMonday(notMonday) != isMonday {
|
|
t.Error("Wrong date conversion!")
|
|
}
|
|
}
|