Skip to content

Commit

Permalink
Add compact() test (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Feb 17, 2020
1 parent d9da54e commit 95c9482
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/flash-store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,27 @@ test('Only one instance can use the database directory', async t => {
}
})

test('compact()', async t => {
for await (const store of storeFixture()) {
try {
await store.size
const db = (store as any).levelDb.db.db.db
await new Promise((resolve, reject) => {
db.compact((err: any) => {
if (err) {
return reject(err)
}
resolve()
})
})

t.pass('compacted')
} catch (e) {
t.fail(e)
}
}
})

/**
* Fixtures
*/
Expand Down

0 comments on commit 95c9482

Please sign in to comment.