mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-16 17:48:49 +02:00
test:#68 fix test
This commit is contained in:
@ -69,7 +69,7 @@ func FetchAndParse(season, label string) (model.SeminarGroup, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return model.SeminarGroup{}, err
|
return model.SeminarGroup{}, err
|
||||||
}
|
}
|
||||||
return parseSeminarGroup(result, season), nil
|
return parseSeminarGroup(result), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func SplitEventType(events []model.Event) ([]model.Event, error) {
|
func SplitEventType(events []model.Event) ([]model.Event, error) {
|
||||||
@ -90,7 +90,7 @@ func SplitEventType(events []model.Event) ([]model.Event, error) {
|
|||||||
return events, nil
|
return events, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseSeminarGroup(result string, semester string) model.SeminarGroup {
|
func parseSeminarGroup(result string) model.SeminarGroup {
|
||||||
doc, err := html.Parse(strings.NewReader(result))
|
doc, err := html.Parse(strings.NewReader(result))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error occurred while parsing the HTML document: %s\n", err.Error())
|
fmt.Printf("Error occurred while parsing the HTML document: %s\n", err.Error())
|
||||||
|
@ -593,8 +593,7 @@ func TestIsWinterSemester(t *testing.T) {
|
|||||||
|
|
||||||
func Test_parseSeminarGroup(t *testing.T) {
|
func Test_parseSeminarGroup(t *testing.T) {
|
||||||
type args struct {
|
type args struct {
|
||||||
result string
|
result string
|
||||||
semester string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//read string from fil
|
//read string from fil
|
||||||
@ -613,8 +612,7 @@ func Test_parseSeminarGroup(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "Test 1",
|
name: "Test 1",
|
||||||
args: args{
|
args: args{
|
||||||
result: htmlString,
|
result: htmlString,
|
||||||
semester: "ws",
|
|
||||||
},
|
},
|
||||||
want: model.SeminarGroup{
|
want: model.SeminarGroup{
|
||||||
Course: "23SAM",
|
Course: "23SAM",
|
||||||
@ -838,7 +836,7 @@ func Test_parseSeminarGroup(t *testing.T) {
|
|||||||
|
|
||||||
//sort Arrays by StartDate
|
//sort Arrays by StartDate
|
||||||
sortEventsByStartDate(tt.want.Events)
|
sortEventsByStartDate(tt.want.Events)
|
||||||
got := parseSeminarGroup(tt.args.result, tt.args.semester)
|
got := parseSeminarGroup(tt.args.result)
|
||||||
sortEventsByStartDate(got.Events)
|
sortEventsByStartDate(got.Events)
|
||||||
|
|
||||||
if !reflect.DeepEqual(got, tt.want) {
|
if !reflect.DeepEqual(got, tt.want) {
|
||||||
|
Reference in New Issue
Block a user