mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
Merge pull request #725 from orbitdb/fix/catch-unhandled-error-in-test
Catch unhandled error in test
This commit is contained in:
commit
fda5ea9cb8
@ -122,9 +122,18 @@ Object.keys(testAPIs).forEach(API => {
|
|||||||
|
|
||||||
it('closes database while loading', async () => {
|
it('closes database while loading', async () => {
|
||||||
db = await orbitdb1.eventlog(address)
|
db = await orbitdb1.eventlog(address)
|
||||||
db.load() // don't wait for load to finish
|
await new Promise(async (resolve, reject) => {
|
||||||
await db.close()
|
// don't wait for load to finish
|
||||||
assert.equal(db._cache.store, null)
|
db.load().catch(e => {
|
||||||
|
if (e.toString() !== 'ReadError: Database is not open') {
|
||||||
|
reject(e)
|
||||||
|
} else {
|
||||||
|
assert.equal(db._cache.store, null)
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
await db.close()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('load, add one, close - several times', async () => {
|
it('load, add one, close - several times', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user