mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-27 05:17:49 +08:00
29 lines
609 B
Go
29 lines
609 B
Go
package bitswap
|
|
|
|
import (
|
|
"testing"
|
|
|
|
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
|
|
|
u "github.com/jbenet/go-ipfs/util"
|
|
testutil "github.com/jbenet/go-ipfs/util/testutil"
|
|
)
|
|
|
|
func TestBlockReturnsErr(t *testing.T) {
|
|
off := NewOfflineExchange()
|
|
_, err := off.Block(context.Background(), u.Key("foo"))
|
|
if err != nil {
|
|
return // as desired
|
|
}
|
|
t.Fail()
|
|
}
|
|
|
|
func TestHasBlockReturnsNil(t *testing.T) {
|
|
off := NewOfflineExchange()
|
|
block := testutil.NewBlockOrFail(t, "data")
|
|
err := off.HasBlock(context.Background(), block)
|
|
if err != nil {
|
|
t.Fatal("")
|
|
}
|
|
}
|