From db9070e0cade16032543a1677221ec3657397272 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Fri, 20 Jul 2018 14:03:19 +0200 Subject: [PATCH] Fix api tests License: MIT Signed-off-by: Hector Sanjuan --- api/types_test.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/api/types_test.go b/api/types_test.go index 7a76cf6c..b15e9094 100644 --- a/api/types_test.go +++ b/api/types_test.go @@ -190,29 +190,31 @@ func TestPinConv(t *testing.T) { parents := cid.NewSet() parents.Add(testCid2) c := Pin{ - Cid: testCid1, - Allocations: []peer.ID{testPeerID1}, - ReplicationFactorMax: -1, - ReplicationFactorMin: -1, - Recursive: true, - Parents: parents, - Name: "A test pin", - Type: CdagType, - Clusterdag: testCid4, + Cid: testCid1, + Type: ClusterDAGType, + Allocations: []peer.ID{testPeerID1}, + Parents: parents, + MaxDepth: -1, + ClusterDAG: testCid4, + PinOptions: PinOptions{ + ReplicationFactorMax: -1, + ReplicationFactorMin: -1, + Name: "A test pin", + }, } newc := c.ToSerial().ToPin() - if c.Cid.String() != newc.Cid.String() || + if !c.Cid.Equals(newc.Cid) || c.Allocations[0] != newc.Allocations[0] || c.ReplicationFactorMin != newc.ReplicationFactorMin || c.ReplicationFactorMax != newc.ReplicationFactorMax || - c.Recursive != newc.Recursive || + c.MaxDepth != newc.MaxDepth || c.Parents.Len() != newc.Parents.Len() || c.Parents.Keys()[0].String() != newc.Parents.Keys()[0].String() || c.Name != newc.Name || c.Type != newc.Type || - c.Clusterdag.String() != newc.Clusterdag.String() { + !c.ClusterDAG.Equals(newc.ClusterDAG) { - fmt.Printf("c: %v\ncnew: %v\n", c, newc) + fmt.Printf("c: %+v\ncnew: %+v\n", c, newc) t.Fatal("mismatch") }