Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/basic.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const ScopeLock = require('scope-lock')
const definition = require('./fixtures/definition')
const { test } = require('./helpers')
const tmp = require('test-tmp')
Expand Down Expand Up @@ -607,3 +608,21 @@ test('enum as key type', async function ({ create, bee }, t) {

await db.close()
})

test.solo('concurrency does not cause missed data', async function ({ create }, t) {
const db = await create(definition)

const tx = db.transaction()
await tx.insert('members', { id: '1', age: 25 })

const prom = tx.insert('members', { id: '2', age: 25 })
await Promise.all([tx.flush(), prom])

let nrEntries = 0
for await (const _ of db.find('members')) nrEntries++
console.log('final entries:', nrEntries)

t.is(nrEntries, 2, 'unfinished insert is not lost')

await db.close()
})
Loading