Files
htwkalender-pwa/backend/service/events/courseService_test.go

40 lines
760 B
Go

package events
import (
"reflect"
"testing"
)
func Test_removeEmptyCourses(t *testing.T) {
type args struct {
courses []string
}
tests := []struct {
name string
args args
want []string
}{
{
name: "Test remove empty courses",
args: args{
courses: []string{"", "test", "test2", ""},
},
want: []string{"test", "test2"},
},
{
name: "Test remove empty courses",
args: args{
courses: []string{"", "test", "test2", "", "test3"},
},
want: []string{"test", "test2", "test3"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := removeEmptyCourses(tt.args.courses); !reflect.DeepEqual(got, tt.want) {
t.Errorf("removeEmptyCourses() = %v, want %v", got, tt.want)
}
})
}
}