Skip to content

Commit

Permalink
test: fix race condition (#90)
Browse files Browse the repository at this point in the history
* fix: race condition in unit test

* chore: lint fix
  • Loading branch information
matthewkeil authored Jan 20, 2024
1 parent c64eb06 commit 9ff2e82
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/multithreading-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ test('check multithreading flag works as expected', async function (t) {
t.plan(9)
const location = tempy.directory()
const db1 = new ClassicLevel(location)
const db2 = new ClassicLevel(location)

// check that must set multithreading flag on all instances
await db1.open()
t.is(db1.location, location)

// check that must set multithreading flag on all instances
let db2
try {
db2 = new ClassicLevel(location)
await db2.open({ multithreading: true })
} catch (err) {
t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN', 'second instance failed to open')
Expand Down

0 comments on commit 9ff2e82

Please sign in to comment.