diff --git a/collections.go b/collections.go index b0c633d..28bdb02 100644 --- a/collections.go +++ b/collections.go @@ -126,28 +126,24 @@ func OrderedCollectionPageNew(parent CollectionInterface) *OrderedCollectionPage // Append adds an element to an OrderedCollection func (o *OrderedCollection) Append(ob Item) error { o.OrderedItems = append(o.OrderedItems, ob) - o.TotalItems++ return nil } // Append adds an element to a Collection func (c *Collection) Append(ob Item) error { c.Items = append(c.Items, ob) - c.TotalItems++ return nil } // Append adds an element to an OrderedCollectionPage func (o *OrderedCollectionPage) Append(ob Item) error { o.OrderedItems = append(o.OrderedItems, ob) - o.TotalItems++ return nil } // Append adds an element to a CollectionPage func (c *CollectionPage) Append(ob Item) error { c.Items = append(c.Items, ob) - c.TotalItems++ return nil } diff --git a/collections_test.go b/collections_test.go index 6af3dd7..7d99e0c 100644 --- a/collections_test.go +++ b/collections_test.go @@ -65,9 +65,9 @@ func Test_OrderedCollection_Append(t *testing.T) { c := OrderedCollectionNew(id) c.Append(val) - if c.TotalItems != 1 { - t.Errorf("Inbox collection of %q should have one element", *c.GetID()) - } + //if c.TotalItems != 1 { + // t.Errorf("Inbox collection of %q should have one element", *c.GetID()) + //} if !reflect.DeepEqual(c.OrderedItems[0], val) { t.Errorf("First item in Inbox is does not match %q", val.ID) } @@ -81,9 +81,9 @@ func TestCollection_Append(t *testing.T) { c := CollectionNew(id) c.Append(val) - if c.TotalItems != 1 { - t.Errorf("Inbox collection of %q should have one element", *c.GetID()) - } + //if c.TotalItems != 1 { + // t.Errorf("Inbox collection of %q should have one element", *c.GetID()) + //} if !reflect.DeepEqual(c.Items[0], val) { t.Errorf("First item in Inbox is does not match %q", val.ID) } @@ -102,9 +102,9 @@ func TestCollectionPage_Append(t *testing.T) { if p.PartOf != c.GetLink() { t.Errorf("Collection page should point to collection %q", c.GetLink()) } - if p.TotalItems != 1 { - t.Errorf("Collection page of %q should have exactly one element", *p.GetID()) - } + //if p.TotalItems != 1 { + // t.Errorf("Collection page of %q should have exactly one element", *p.GetID()) + //} if !reflect.DeepEqual(p.Items[0], val) { t.Errorf("First item in Inbox is does not match %q", val.ID) } @@ -288,9 +288,9 @@ func TestOrderedCollection_Append(t *testing.T) { if p.PartOf != c.GetLink() { t.Errorf("Ordereed collection page should point to ordered collection %q", c.GetLink()) } - if p.TotalItems != 1 { - t.Errorf("Ordered collection page of %q should have exactly one element", *p.GetID()) - } + //if p.TotalItems != 1 { + // t.Errorf("Ordered collection page of %q should have exactly one element", *p.GetID()) + //} if !reflect.DeepEqual(p.OrderedItems[0], val) { t.Errorf("First item in Inbox is does not match %q", val.ID) } @@ -474,9 +474,7 @@ func TestOrderedCollectionPage_Append(t *testing.T) { if p.PartOf != c.GetLink() { t.Errorf("OrderedCollection page should point to OrderedCollection %q", c.GetLink()) } - if p.TotalItems != 1 { - t.Errorf("OrderedCollection page of %q should have exactly one element", *p.GetID()) - } + //a if !reflect.DeepEqual(p.OrderedItems[0], val) { t.Errorf("First item in Inbox is does not match %q", val.ID) }