nim-datastore/tests/datastore/test_null_datastore.nim
Michael Bradley, Jr 0c5d805257
refactor base API to be async
and refactor Datastore impls and tests accordingly

Closes #7
2022-07-04 22:28:41 -05:00

38 lines
740 B
Nim

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