diff --git a/test/shared/rwlock.test.ts b/test/shared/rwlock.test.ts index 861c83f..b1e3b9b 100644 --- a/test/shared/rwlock.test.ts +++ b/test/shared/rwlock.test.ts @@ -119,16 +119,15 @@ describe('RwLock', () => { assert.deepEqual(results.sort(), ['r1', 'r2']); }); - it('tryReadLock returns a guard when unlocked', () => { + it('tryReadLock returns a guard when unlocked', async () => { const rw = rwlock(); const guard = rw.tryReadLock(); assert.ok(guard); assert.equal(typeof guard[Symbol.dispose], 'function'); guard[Symbol.dispose](); - // Should be able to read-lock again after dispose - const guard2 = rw.tryReadLock(); - assert.ok(guard2); - rw.readUnlock(); + // writeLock only succeeds if readUnlock was called (reader count back to 0) + await rw.writeLock(); + rw.writeUnlock(); }); it('multiple concurrent tryReadLock calls all succeed', () => {