github.com/metacurrency/holochain@v0.1.0-alpha-26.0.20200915073418-5c83169c9b5b/action_commit_test.go (about)

     1  package holochain
     2  
     3  import (
     4    "fmt"
     5    . "github.com/smartystreets/goconvey/convey"
     6    "testing"
     7  )
     8  
     9  func TestActionCommit(t *testing.T) {
    10  	nodesCount := 3
    11  	mt := setupMultiNodeTesting(nodesCount)
    12  	defer mt.cleanupMultiNodeTesting()
    13  
    14  	h := mt.nodes[0]
    15  
    16  	profileHash := commit(h, "profile", `{"firstName":"Zippy","lastName":"Pinhead"}`)
    17  	linksHash := commit(h, "rating", fmt.Sprintf(`{"Links":[{"Base":"%s","Link":"%s","Tag":"4stars"}]}`, h.nodeIDStr, profileHash.String()))
    18  	ringConnect(t, mt.ctx, mt.nodes, nodesCount)
    19  
    20  	Convey("when committing a link the linkEntry itself should be published to the DHT", t, func() {
    21  		req := GetReq{H: linksHash, GetMask: GetMaskEntry}
    22  		_, err := callGet(h, req, &GetOptions{GetMask: req.GetMask})
    23  		So(err, ShouldBeNil)
    24  
    25  		h2 := mt.nodes[2]
    26  		_, err = callGet(h2, req, &GetOptions{GetMask: req.GetMask})
    27  		So(err, ShouldBeNil)
    28  
    29  	})
    30  }