nim-datastore/tests/datastore/test_null_datastore.nim

38 lines
740 B
Nim
Raw Normal View History

2022-05-11 10:50:05 -05:00
import std/options
import pkg/asynctest/unittest2
import pkg/chronos
2022-05-11 10:50:05 -05:00
import pkg/stew/results
import ../../datastore/null_datastore
import ./templates
2022-05-11 10:50:05 -05:00
suite "NullDatastore":
let
key = Key.init("a").get
ds = NullDatastore.new()
2022-05-11 10:50:05 -05:00
asyncTest "new":
2022-05-11 10:50:05 -05:00
check: not ds.isNil
asyncTest "put":
check: (await ds.put(key, @[1.byte])).isOk
2022-05-11 10:50:05 -05:00
asyncTest "delete":
check: (await ds.delete(key)).isOk
2022-05-11 10:50:05 -05:00
asyncTest "contains":
2022-05-11 10:50:05 -05:00
check:
(await ds.contains(key)).isOk
(await ds.contains(key)).get == false
2022-05-11 10:50:05 -05:00
asyncTest "get":
2022-05-11 10:50:05 -05:00
check:
(await ds.get(key)).isOk
(await ds.get(key)).get.isNone
2022-05-11 10:50:05 -05:00
# asyncTest "query":
2022-05-11 10:50:05 -05:00
# check:
# (await ds.query(...)).isOk
# (await ds.query(...)).get.isNone