feat:#57 updated function and calc

This commit is contained in:
Elmar Kresse
2024-04-11 17:23:04 +02:00
parent 2f0fa03b58
commit 12ad568088
2 changed files with 40 additions and 23 deletions

View File

@@ -100,14 +100,14 @@ func Test_switchNameAndNotesForExam(t *testing.T) {
}
}
func Test_isSummerSemester(t *testing.T) {
func Test_calculateSemesterList(t *testing.T) {
type args struct {
clock mockTime.MockClock
clock mockTime.Clock
}
tests := []struct {
name string
args args
want bool
want []string
}{
{
name: "is summer semester",
@@ -116,22 +116,31 @@ func Test_isSummerSemester(t *testing.T) {
NowTime: time.Date(2024, 6, 1, 0, 0, 0, 0, time.UTC),
},
},
want: true,
want: []string{"ss"},
},
{
name: "is not summer semester",
name: "is winter semester",
args: args{
clock: mockTime.MockClock{
NowTime: time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC),
},
},
want: false,
want: []string{"ws"},
},
{
name: "is in both",
args: args{
clock: mockTime.MockClock{
NowTime: time.Date(2024, 3, 22, 0, 0, 0, 0, time.UTC),
},
},
want: []string{"ss", "ws"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := isSummerSemester(tt.args.clock); got != tt.want {
t.Errorf("isSummerSemester() = %v, want %v", got, tt.want)
if got := calculateSemesterList(tt.args.clock); !reflect.DeepEqual(got, tt.want) {
t.Errorf("calculateSemesterList() = %v, want %v", got, tt.want)
}
})
}