From 4e7a507c361276d95c4bfe01a8528570f1e53797 Mon Sep 17 00:00:00 2001 From: Liran Cohen Date: Fri, 22 Dec 2023 17:45:42 -0500 Subject: [PATCH] add timeouts to tests --- tests/scenarios/subscriptions.spec.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/scenarios/subscriptions.spec.ts b/tests/scenarios/subscriptions.spec.ts index 2829ea39f..0ffda0984 100644 --- a/tests/scenarios/subscriptions.spec.ts +++ b/tests/scenarios/subscriptions.spec.ts @@ -302,7 +302,9 @@ export function testSubscriptionScenarios(): void { expect(aliceMessage2Reply.status.code).to.equal(202); authorizeSpy.restore(); - await Time.minimalSleep(); + while (messageCids.length < 2) { + await Time.minimalSleep(); + } expect(authorizeSpy.callCount).to.equal(0, 'reauthorize'); // authorize is never called expect(messageCids.length).to.equal(2, 'messageCids'); @@ -378,7 +380,9 @@ export function testSubscriptionScenarios(): void { expect(aliceMessage2Reply.status.code).to.equal(202); authorizeSpy.restore(); - await Time.minimalSleep(); + while (messageCids.length < 2) { + await Time.minimalSleep(); + } expect(authorizeSpy.callCount).to.equal(2, 'reauthorize'); // authorize on each message expect(messageCids.length).to.equal(2, 'messageCids'); @@ -475,7 +479,9 @@ export function testSubscriptionScenarios(): void { authorizeSpy.restore(); clock.restore(); - await Time.minimalSleep(); + while (messageCids.length < 3) { + await Time.minimalSleep(); + } expect(authorizeSpy.callCount).to.equal(1, 'reauthorize'); // called once after the TTL has passed expect(messageCids.length).to.equal(3, 'messageCids');