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