@@ -1035,9 +1035,9 @@ describe(DBTransaction.name, () => {
10351035 ) ;
10361036 await db . withTransactionF ( async ( tran2 ) => {
10371037 await tran2 . lock ( [ 'foo' , 'read' ] ) ;
1038- await expect ( tran2 . lock ( [ 'bar' , 'write' , 0 ] ) ) . rejects . toThrow (
1039- locksErrors . ErrorAsyncLocksTimeout ,
1040- ) ;
1038+ await expect (
1039+ tran2 . lock ( [ 'bar' , 'write' , { timer : 0 } ] ) ,
1040+ ) . rejects . toThrow ( locksErrors . ErrorAsyncLocksTimeout ) ;
10411041 expect ( tran1 . locks . size ) . toBe ( 2 ) ;
10421042 expect ( tran1 . locks . has ( 'foo' ) ) . toBe ( true ) ;
10431043 expect ( tran1 . locks . get ( 'foo' ) ! . type ) . toBe ( 'read' ) ;
@@ -1097,9 +1097,9 @@ describe(DBTransaction.name, () => {
10971097 // This is a noop, because `tran1` owns `key1` and `key2`
10981098 await tran2 . unlock ( 'key1' , 'key2' ) ;
10991099 // This fails because `key1` is still locked by `tran1`
1100- await expect ( tran2 . lock ( [ 'key1' , 'write' , 0 ] ) ) . rejects . toThrow (
1101- locksErrors . ErrorAsyncLocksTimeout ,
1102- ) ;
1100+ await expect (
1101+ tran2 . lock ( [ 'key1' , 'write' , { timer : 0 } ] ) ,
1102+ ) . rejects . toThrow ( locksErrors . ErrorAsyncLocksTimeout ) ;
11031103 await tran1 . unlock ( 'key1' ) ;
11041104 expect ( tran1 . locks . size ) . toBe ( 1 ) ;
11051105 // This succeeds because `key1` is now unlocked
@@ -1109,9 +1109,9 @@ describe(DBTransaction.name, () => {
11091109 await tran1 . unlock ( 'key1' ) ;
11101110 expect ( tran2 . locks . has ( 'key1' ) ) . toBe ( true ) ;
11111111 expect ( tran1 . locks . has ( 'key1' ) ) . toBe ( false ) ;
1112- await expect ( tran1 . lock ( [ 'key1' , 'write' , 0 ] ) ) . rejects . toThrow (
1113- locksErrors . ErrorAsyncLocksTimeout ,
1114- ) ;
1112+ await expect (
1113+ tran1 . lock ( [ 'key1' , 'write' , { timer : 0 } ] ) ,
1114+ ) . rejects . toThrow ( locksErrors . ErrorAsyncLocksTimeout ) ;
11151115 } ) ;
11161116 await tran1 . lock ( 'key1' ) ;
11171117 expect ( tran1 . locks . has ( 'key1' ) ) . toBe ( true ) ;
@@ -1126,8 +1126,8 @@ describe(DBTransaction.name, () => {
11261126 // Currently a deadlock can happen, and the only way to avoid is to use timeouts
11271127 // In the future, we want to have `DBTransaction` detect deadlocks
11281128 // and automatically give us `ErrorDBTransactionDeadlock` exception
1129- const p1 = tran1 . lock ( [ 'bar' , 'write' , 50 ] ) ;
1130- const p2 = tran2 . lock ( [ 'foo' , 'write' , 50 ] ) ;
1129+ const p1 = tran1 . lock ( [ 'bar' , 'write' , { timer : 50 } ] ) ;
1130+ const p2 = tran2 . lock ( [ 'foo' , 'write' , { timer : 50 } ] ) ;
11311131 const results = await Promise . allSettled ( [ p1 , p2 ] ) ;
11321132 expect (
11331133 results . every (
0 commit comments