fix:#41 fixed sonarqube hotspots

This commit is contained in:
Elmar Kresse
2024-06-24 12:18:48 +02:00
parent cb8de60d21
commit ff2fa1b67d
6 changed files with 182 additions and 6 deletions

View File

@@ -501,3 +501,122 @@ func Test_replaceTimeForDate(t *testing.T) {
})
}
}
func Test_isSummerSemester(t *testing.T) {
type args struct {
month time.Month
}
tests := []struct {
name string
args args
want bool
}{
{
name: "Test Summer March",
args: args{
month: time.March,
},
want: true,
},
{
name: "Test Summer September",
args: args{
month: time.September,
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := isSummerSemester(tt.args.month); got != tt.want {
t.Errorf("isSummerSemester() = %v, want %v", got, tt.want)
}
})
}
}
func Test_isWinterSemester(t *testing.T) {
type args struct {
month time.Month
}
tests := []struct {
name string
args args
want bool
}{
{
name: "Test Winter March",
args: args{
month: time.March,
},
want: true,
},
{
name: "Test Winter September",
args: args{
month: time.September,
},
want: true,
},
{
name: "Test Winter November",
args: args{
month: time.November,
},
want: true,
},
{
name: "Test Winter February",
args: args{
month: time.February,
},
want: true,
},
{
name: "Test Winter June",
args: args{
month: time.June,
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := isWinterSemester(tt.args.month); got != tt.want {
t.Errorf("isWinterSemester() = %v, want %v", got, tt.want)
}
})
}
}
func Test_parseSeminarGroup(t *testing.T) {
type args struct {
result string
}
tests := []struct {
name string
args args
want model.SeminarGroup
}{
{
name: "Test 1",
args: args{
result: "B435 SBB (wpf) & B348 BIB (pf) 5. FS",
},
want: model.SeminarGroup{
Events: []model.Event{
{
Name: "B435 SBB (wpf) & B348 BIB (pf) 5. FS",
},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := parseSeminarGroup(tt.args.result); !reflect.DeepEqual(got, tt.want) {
t.Errorf("parseSeminarGroup() = %v, want %v", got, tt.want)
}
})
}
}