mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-20 01:38:55 +00:00
add list block tests
This commit is contained in:
parent
9b729e0d76
commit
4f5f142a37
@ -106,3 +106,15 @@ suite "Cache Store tests":
|
||||
await store.delBlock(newBlock2.cid)
|
||||
store.currentSize == 200
|
||||
newBlock2.cid notin store
|
||||
|
||||
test "listBlocks":
|
||||
discard await store.putBlock(newBlock1)
|
||||
|
||||
var listed = false
|
||||
await store.listBlocks(
|
||||
proc(blk: Block) {.gcsafe, async.} =
|
||||
check blk.cid in store
|
||||
listed = true
|
||||
)
|
||||
|
||||
check listed
|
||||
|
@ -52,11 +52,13 @@ suite "FS Store":
|
||||
|
||||
check store.hasBlock(newBlock.cid)
|
||||
|
||||
test "blockList":
|
||||
test "listBlocks":
|
||||
createDir(store.blockPath(newBlock.cid).parentDir)
|
||||
writeFile(store.blockPath(newBlock.cid), newBlock.data)
|
||||
|
||||
check (await store.blockList()) == @[newBlock.cid]
|
||||
await store.listBlocks(
|
||||
proc(blk: Block) {.gcsafe, async.} =
|
||||
check blk.cid == newBlock.cid)
|
||||
|
||||
test "fail hasBlock":
|
||||
check not store.hasBlock(newBlock.cid)
|
||||
|
Loading…
x
Reference in New Issue
Block a user