Skip to content

Commit

Permalink
Add corestore gc test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewosh committed Sep 15, 2020
1 parent a37692f commit 3c3622d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,3 +489,29 @@ test('can connect over a tcp socket', async t => {
await cleanup()
t.end()
})

test('handles corestore gc correctly', async t => {
const { client, cleanup } = await createOne({
cacheSize: 1
})
const store1 = client.corestore()
const store2 = client.corestore()

const core1 = store1.get()
await core1.ready()

const core2 = store2.get()
const core3 = store2.get(core1.key)
await core2.ready()
await core3.ready()

try {
await core3.append('hello world')
t.pass('append did not error')
} catch (err) {
t.fail(err)
}

await cleanup()
t.end()
})

0 comments on commit 3c3622d

Please sign in to comment.