From 9c61927c1b8b3359546d0c4cb0979a27cbd139c6 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 23 Feb 2025 10:04:27 +0000 Subject: [PATCH] Improve test --- .../src/sync-operations/document-lock.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/sync-client/src/sync-operations/document-lock.test.ts b/frontend/sync-client/src/sync-operations/document-lock.test.ts index 8def7e6b..2bc05e69 100644 --- a/frontend/sync-client/src/sync-operations/document-lock.test.ts +++ b/frontend/sync-client/src/sync-operations/document-lock.test.ts @@ -58,6 +58,7 @@ describe("Document Lock Operations", () => { let firstResolved = false; let secondResolved = false; + let thirdResolved = false; const firstWaitPromise = waitForDocumentLock(testPath).then(() => { firstResolved = true; @@ -67,13 +68,23 @@ describe("Document Lock Operations", () => { secondResolved = true; }); + const thirdWaitPromise = waitForDocumentLock(testPath).then(() => { + thirdResolved = true; + }); + unlockDocument(testPath); await firstWaitPromise; expect(firstResolved).toBe(true); expect(secondResolved).toBe(false); + expect(thirdResolved).toBe(false); unlockDocument(testPath); await secondWaitPromise; expect(secondResolved).toBe(true); + expect(thirdResolved).toBe(false); + + unlockDocument(testPath); + await thirdWaitPromise; + expect(thirdResolved).toBe(true); }); });