This commit is contained in:
Erik Winter 2024-12-02 08:16:06 +01:00
parent e0a7fb48b9
commit 45125bd02d
1 changed files with 5 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import (
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"go-mod.ewintr.nl/planner/item" "go-mod.ewintr.nl/planner/item"
) )
@ -50,14 +51,10 @@ func TestMemoryUpdate(t *testing.T) {
if actErr != nil { if actErr != nil {
t.Errorf("exp nil, got %v", actErr) t.Errorf("exp nil, got %v", actErr)
} }
if len(actItems) != 2 { if diff := cmp.Diff([]item.Item{t1, t2}, actItems, cmpopts.SortSlices(func(i, j item.Item) bool {
t.Errorf("exp 2, gor %d", len(actItems)) return i.ID < j.ID
} })); diff != "" {
if actItems[0].ID != t1.ID { t.Errorf("(exp +, got -)\n%s", diff)
t.Errorf("exp %v, got %v", actItems[0].ID, t1.ID)
}
if actItems[1].ID != t2.ID {
t.Errorf("exp %v, got %v", actItems[1].ID, t2.ID)
} }
actItems, actErr = mem.Updated([]item.Kind{}, before) actItems, actErr = mem.Updated([]item.Kind{}, before)