mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 02:30:39 +08:00
Add testutil package and function to generate a dagservice
This commit is contained in:
18
util/testutil/gen.go
Normal file
18
util/testutil/gen.go
Normal file
@ -0,0 +1,18 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
|
||||
bsrv "github.com/jbenet/go-ipfs/blockservice"
|
||||
dag "github.com/jbenet/go-ipfs/merkledag"
|
||||
)
|
||||
|
||||
func GetDAGServ(t testing.TB) dag.DAGService {
|
||||
dstore := ds.NewMapDatastore()
|
||||
bserv, err := bsrv.NewBlockService(dstore, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return dag.NewDAGService(bserv)
|
||||
}
|
Reference in New Issue
Block a user