Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"temp-write": "^4.0.0"
},
"devDependencies": {
"aegir": "^21.10.2",
"aegir": "^22.0.0",
"benchmark": "^2.1.4",
"go-ipfs-dep": "^0.5.0",
"husky": "^4.2.5",
Expand Down
1 change: 0 additions & 1 deletion src/utils.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const { nanoid } = require('nanoid')
const deleteDb = (path) => {
return new Promise((resolve, reject) => {
const keys = self.indexedDB.deleteDatabase(path)
keys.onblocked = () => reject(new Error('Database is still open.'))
keys.onerror = (err) => reject(err)
keys.onsuccess = () => resolve()
})
Expand Down
22 changes: 22 additions & 0 deletions test/browser.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,28 @@ describe('utils browser version', function () {
expect(await repoExists('ipfs_test_remove/datastore')).to.be.false()
})

it('removeRepo should wait for db to be closed', async () => {
const ctl = await createController({
test: true,
type: 'proc',
disposable: false,
ipfsOptions: { repo: 'ipfs_test_remove' },
ipfsModule: require('ipfs')
})
await ctl.init()
await ctl.start()

await Promise.all([
removeRepo('ipfs_test_remove'),
ctl.stop()
])

expect(await repoExists('ipfs_test_remove')).to.be.false()
expect(await repoExists('ipfs_test_remove/keys')).to.be.false()
expect(await repoExists('ipfs_test_remove/blocks')).to.be.false()
expect(await repoExists('ipfs_test_remove/datastore')).to.be.false()
})

describe('repoExists', () => {
it('should resolve true when repo exists', async () => {
const f = createFactory({ test: true })
Expand Down