Skip to content

Commit

Permalink
fix: race condition in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkeil committed Dec 1, 2023
1 parent c64eb06 commit e82f822
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 e82f822

Please sign in to comment.