I am using async-mutex I just want to test a functionality for it specifically I want to confirm whether the Mutex.acquire method keeps things blocked.
it('should remain blocked when accessing the mutex a second time', async () => {
const mutex = new Mutex();
const release = await mutex.acquire();
expect(mutex.isLocked()).toBeTruthy();
expect( async () => { await mutex.acquire() } ).toStillBeRunningAfterSpecifiedSeconds(5);
});
I tried
expect(await mutex.acquire()).toThrow("Timeout");
Since I get this message
Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Error:
but no luck.