mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-07-16 17:48:51 +02:00
53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package fetch
|
|
|
|
import "testing"
|
|
|
|
func Test_extractSemesterAndYear(t *testing.T) {
|
|
type args struct {
|
|
semesterString string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want string
|
|
want1 string
|
|
}{
|
|
// TODO: Add test cases.
|
|
{
|
|
name: "Test 1",
|
|
args: args{
|
|
semesterString: "Wintersemester 2023/24 (Planungszeitraum 01.09.2023 bis 03.03.2024)",
|
|
},
|
|
want: "ws",
|
|
want1: "2023",
|
|
},
|
|
{
|
|
name: "Test 2",
|
|
args: args{
|
|
semesterString: "Sommersemester 2023 (Planungszeitraum 06.03. bis 31.08.2023)",
|
|
},
|
|
want: "ss",
|
|
want1: "2023",
|
|
},
|
|
{
|
|
name: "Test 3",
|
|
args: args{
|
|
semesterString: "Sommersemester 2010 (Planungszeitraum 06.03. bis 31.08.2023)",
|
|
},
|
|
want: "ss",
|
|
want1: "2010",
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got, got1 := extractSemesterAndYear(tt.args.semesterString)
|
|
if got != tt.want {
|
|
t.Errorf("extractSemesterAndYear() got = %v, want %v", got, tt.want)
|
|
}
|
|
if got1 != tt.want1 {
|
|
t.Errorf("extractSemesterAndYear() got1 = %v, want %v", got1, tt.want1)
|
|
}
|
|
})
|
|
}
|
|
}
|