Version: Deno x.x.x
Memory backed KV data disappearing under test
I'm trying to figure out why my tests are failing, and it turns out that data stored in KV is disappearing mid test. The tests are run with DENO\_KV\_PATH=:memory: deno test -A ${file} --unstable-kv --inspect-brk, so the KV store is in-memory.
The test calls a `createUser()` function to store a test user, followed by a `createVote()` function, which retrieves the stored user. I've verified that the user was stored correctly, but on attempting to retrieve it, there are no users in the store.
Relevant snippets of the code and output below. As you can see, the createUser() call stores the user which can then be retrieved by key and via list(); in the subsequent call to createVote() the user is no longer there; in fact there are no users at all, event though there were three stored moments ago.
So where is the data going? I did also verify that, in createVote(), the call to kv.getMany()did successfully retrieve the item, also created by the same test, so the KV store hasn't gotten completely wiped.
Version: Deno x.x.x Memory backed KV data disappearing under test
I'm trying to figure out why my tests are failing, and it turns out that data stored in KV is disappearing mid test. The tests are run with
DENO\_KV\_PATH=:memory: deno test -A ${file} --unstable-kv --inspect-brk
, so the KV store is in-memory.The test calls a `createUser()` function to store a test user, followed by a `createVote()` function, which retrieves the stored user. I've verified that the user was stored correctly, but on attempting to retrieve it, there are no users in the store.
Relevant snippets of the code and output below. As you can see, the
createUser()
call stores the user which can then be retrieved by key and vialist()
; in the subsequent call tocreateVote()
the user is no longer there; in fact there are no users at all, event though there were three stored moments ago.So where is the data going? I did also verify that, in
createVote()
, the call tokv.getMany()
did successfully retrieve the item, also created by the same test, so the KV store hasn't gotten completely wiped.Any insights would be appreciated!
db_test.ts:
db-users.ts:
db-items.ts:
Output: