Skip to content

Commit

Permalink
add failing batch test
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed Oct 15, 2024
1 parent 4612792 commit 803cd9f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -824,3 +824,32 @@ test('batch append with huge batch', async function (t) {

await b.close()
})

test('batch does not append but reopens', async function (t) {
const dir = await createTempDir(t)

let core = new Hypercore(dir)

await core.append('hello')

let batch = core.session({ name: 'hello' })

// open and close
await batch.ready()
await batch.close()

await core.close()

core = new Hypercore(dir)

await core.append('hello')

batch = core.session({ name: 'hello' })
await batch.ready()

t.is(core.length, 2)
t.is(batch.length, 1)

await core.close()
await batch.close()
})

0 comments on commit 803cd9f

Please sign in to comment.