mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-16 17:48:49 +02:00
fix:#75 wrong calendar uuid generation
This commit is contained in:
@ -194,7 +194,7 @@ func NewEvent(collection *core.Collection, event model.Event) (*Event, error) {
|
||||
ev.SetBookedAt(event.BookedAt)
|
||||
ev.SetCourse(event.Course)
|
||||
ev.SetSemester(event.Semester)
|
||||
ev.SetUUID(uuid.NewString())
|
||||
ev.SetUUID(event.UUID)
|
||||
return ev, nil
|
||||
}
|
||||
|
||||
|
@ -97,3 +97,79 @@ func TestSwitchNameAndNotesForExam(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_generateUUIDs(t *testing.T) {
|
||||
type args struct {
|
||||
events []model.Event
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want []model.Event
|
||||
}{
|
||||
{
|
||||
name: "generate UUIDs for events",
|
||||
args: args{
|
||||
events: []model.Event{
|
||||
{
|
||||
EventType: "Vorlesung",
|
||||
Name: "Computer Vision II",
|
||||
Course: "Computer Vision",
|
||||
UUID: "",
|
||||
},
|
||||
{
|
||||
EventType: "Pruefung",
|
||||
Name: "C169 Digitale Bildverarbeitung MIM & INM 3. FS (wpf)",
|
||||
Course: "23INM",
|
||||
UUID: "",
|
||||
},
|
||||
{
|
||||
EventType: "Vorlesung",
|
||||
Name: "C398 Visualisierung in NW und Technik IN-M & MI-M 2. FS (wpf)",
|
||||
Course: "24INM",
|
||||
UUID: "",
|
||||
},
|
||||
{
|
||||
EventType: "Vorlesung",
|
||||
Name: "M947 Fluidenergiemaschinen EGB (pf) & MBB & SGB (wpf) 4.FS",
|
||||
Course: "23EGB-EGTa",
|
||||
UUID: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
want: []model.Event{
|
||||
{
|
||||
EventType: "Vorlesung",
|
||||
Name: "Computer Vision II",
|
||||
Course: "Computer Vision",
|
||||
UUID: "8ddd913c-27f0-58b2-be17-e50f2851d482",
|
||||
},
|
||||
{
|
||||
EventType: "Pruefung",
|
||||
Name: "C169 Digitale Bildverarbeitung MIM & INM 3. FS (wpf)",
|
||||
Course: "23INM",
|
||||
UUID: "2a35348d-63ce-511c-8580-893321d104b9",
|
||||
},
|
||||
{
|
||||
EventType: "Vorlesung",
|
||||
Name: "C398 Visualisierung in NW und Technik IN-M & MI-M 2. FS (wpf)",
|
||||
Course: "24INM",
|
||||
UUID: "6051ebd9-dd2b-5646-82c4-091667f414ee",
|
||||
},
|
||||
{
|
||||
EventType: "Vorlesung",
|
||||
Name: "M947 Fluidenergiemaschinen EGB (pf) & MBB & SGB (wpf) 4.FS",
|
||||
Course: "23EGB-EGTa",
|
||||
UUID: "736764e1-fa78-5195-8280-76c996dc8b47",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := generateUUIDs(tt.args.events); !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("generateUUIDs() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user