offline_test.go 493 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
package bitswap

import (
	"testing"
	"time"

	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(u.Key("foo"), time.Second)
	if err != nil {
		return // as desired
	}
	t.Fail()
}

func TestHasBlockReturnsNil(t *testing.T) {
	off := NewOfflineExchange()
	block := testutil.NewBlockOrFail(t, "data")
	err := off.HasBlock(block)
	if err != nil {
		t.Fatal("")
	}
}