nim-dagger/tests/ipfs/testRepo.nim

23 lines
461 B
Nim
Raw Normal View History

import std/unittest
import pkg/ipfs/repo
suite "repo":
let dag = MerkleDag(data: @[1'u8, 2'u8, 3'u8])
var repo: Repo
setup:
repo = Repo()
test "stores Merkle DAGs":
repo.store(dag)
2021-01-14 12:41:54 +00:00
test "retrieves Merkle DAGs by their root id":
repo.store(dag)
2021-01-14 12:41:54 +00:00
check repo.retrieve(dag.rootId) == dag
2021-01-14 12:41:54 +00:00
test "knows which ids are stored":
check repo.contains(dag.rootId) == false
repo.store(dag)
2021-01-14 12:41:54 +00:00
check repo.contains(dag.rootId) == true