From 8a2b69e8c0707a72aac0906c506b82918569d6fb Mon Sep 17 00:00:00 2001 From: Marcus Pousette Date: Thu, 14 Dec 2023 13:51:45 +0100 Subject: [PATCH] fix: force messages to be provessed slowly to ensure topology --- packages/transport/stream/src/__tests__/stream.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/transport/stream/src/__tests__/stream.test.ts b/packages/transport/stream/src/__tests__/stream.test.ts index 229e5245d..6b3a002b6 100644 --- a/packages/transport/stream/src/__tests__/stream.test.ts +++ b/packages/transport/stream/src/__tests__/stream.test.ts @@ -742,6 +742,14 @@ describe("streams", function () { }); it("messages are only sent once to each peer", async () => { + streams.forEach((stream) => { + const processFn = stream.stream.processMessage.bind(stream.stream); + stream.stream.processMessage = async (a, b, c) => { + await delay(200); + return processFn(a, b, c); + }; + }); + let totalWrites = 10; expect(streams[0].ack).toHaveLength(0);