@@ -118,53 +118,6 @@ describe('mutex negative test cases. incorrect usage', () => {
118118 jest . resetAllMocks ( ) ;
119119 } ) ;
120120
121- it ( 'should throw an exception if you try to call `tryToLock` method on a locked mutex' , async ( ) => {
122- const resourceId = '3dd6472f-4e4b-4559-b781-cc5d75c4f6f2' ;
123-
124- const client = createRedisClientStub ( ) ;
125-
126- asMockedFunction ( Lua . tryToAcquireLock ) . mockResolvedValueOnce ( 'OK' ) ;
127-
128- const mutex = new RedisMutex ( [ client ] , resourceId ) ;
129-
130- await mutex . lock ( ) ;
131-
132- await expect ( mutex . tryToLock ( ) ) . rejects . toThrowError ( new Error ( 'Already locked' ) ) ;
133-
134- expect ( Lua . tryToAcquireLock ) . toBeCalledTimes ( 1 ) ;
135- expect ( Lua . tryToReleaseLock ) . toBeCalledTimes ( 0 ) ;
136- } ) ;
137-
138- it ( 'should throw an exception if you try to call `lock` method on a locked mutex' , async ( ) => {
139- const resourceId = '3dd6472f-4e4b-4559-b781-cc5d75c4f6f2' ;
140-
141- const client = createRedisClientStub ( ) ;
142-
143- asMockedFunction ( Lua . tryToAcquireLock ) . mockResolvedValueOnce ( 'OK' ) ;
144-
145- const mutex = new RedisMutex ( [ client ] , resourceId ) ;
146-
147- await mutex . lock ( ) ;
148-
149- await expect ( mutex . lock ( ) ) . rejects . toThrowError ( new Error ( 'Already locked' ) ) ;
150-
151- expect ( Lua . tryToAcquireLock ) . toBeCalledTimes ( 1 ) ;
152- expect ( Lua . tryToReleaseLock ) . toBeCalledTimes ( 0 ) ;
153- } ) ;
154-
155- it ( 'should throw an exception if you try to call `unlock` method on a unlocked mutex' , async ( ) => {
156- const resourceId = '3dd6472f-4e4b-4559-b781-cc5d75c4f6f2' ;
157-
158- const client = createRedisClientStub ( ) ;
159-
160- const mutex = new RedisMutex ( [ client ] , resourceId ) ;
161-
162- await expect ( mutex . unlock ( ) ) . rejects . toThrowError ( new Error ( 'Not locked' ) ) ;
163-
164- expect ( Lua . tryToAcquireLock ) . toBeCalledTimes ( 0 ) ;
165- expect ( Lua . tryToReleaseLock ) . toBeCalledTimes ( 0 ) ;
166- } ) ;
167-
168121 it ( 'should throw an exception on failed quorum' , async ( ) => {
169122 const resourceId = '3dd6472f-4e4b-4559-b781-cc5d75c4f6f2' ;
170123 const options = {
0 commit comments