nim-abc/tests/abc/testTxStore.nim

26 lines
658 B
Nim
Raw Normal View History

2021-06-30 09:22:28 +00:00
import abc/txstore
import ./basics
import ./alicebob
suite "Transaction Store":
let genesis = Transaction.genesis
let transaction = Transaction.example
2021-07-05 09:54:45 +00:00
let ack = Ack.example
2021-06-30 09:22:28 +00:00
test "is initialized with a genesis transaction":
2021-07-14 15:10:26 +00:00
let store = TxStore.new(genesis)
check store[genesis.hash] == genesis.some
2021-06-30 09:22:28 +00:00
test "stores transactions":
2021-07-14 15:10:26 +00:00
let store = TxStore.new(genesis)
check store[transaction.hash].isNone
2021-06-30 09:22:28 +00:00
store.add(transaction)
check store[transaction.hash] == transaction.some
2021-07-05 09:54:45 +00:00
test "stores acks":
2021-07-14 15:10:26 +00:00
let store = TxStore.new(genesis)
check store[ack.hash].isNone
2021-07-05 09:54:45 +00:00
store.add(ack)
check store[ack.hash] == ack.some