Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

Commit b0bd5d6

Browse files
committed
add basic test
1 parent 424d591 commit b0bd5d6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/block.go

+19
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func (tp *TestSuite) TestBlock(t *testing.T) {
3939

4040
t.Run("TestBlockPut", tp.TestBlockPut)
4141
t.Run("TestBlockPutFormat", tp.TestBlockPutFormat)
42+
t.Run("TestBlockPutStoreCodec", tp.TestBlockPutStoreCodec)
4243
t.Run("TestBlockPutHash", tp.TestBlockPutHash)
4344
t.Run("TestBlockGet", tp.TestBlockGet)
4445
t.Run("TestBlockRm", tp.TestBlockRm)
@@ -82,6 +83,24 @@ func (tp *TestSuite) TestBlockPutFormat(t *testing.T) {
8283
}
8384
}
8485

86+
func (tp *TestSuite) TestBlockPutStoreCodec(t *testing.T) {
87+
ctx, cancel := context.WithCancel(context.Background())
88+
defer cancel()
89+
api, err := tp.makeAPI(ctx)
90+
if err != nil {
91+
t.Fatal(err)
92+
}
93+
94+
res, err := api.Block().Put(ctx, cborBlock(), opt.Block.StoreCodec("cbor"))
95+
if err != nil {
96+
t.Fatal(err)
97+
}
98+
99+
if res.Path().Cid().String() != cborCid {
100+
t.Errorf("got wrong cid: %s", res.Path().Cid().String())
101+
}
102+
}
103+
85104
func (tp *TestSuite) TestBlockPutHash(t *testing.T) {
86105
ctx, cancel := context.WithCancel(context.Background())
87106
defer cancel()

0 commit comments

Comments
 (0)