web: extract reconnect helpers and add tests

This commit is contained in:
Peter Steinberger
2025-11-26 02:39:31 +01:00
parent baf20af17f
commit 765d67cd18
6 changed files with 167 additions and 94 deletions

View File

@@ -61,7 +61,10 @@ describe("web auto-reply", () => {
closeResolvers[0]?.();
const waitForSecondCall = async () => {
const started = Date.now();
while (listenerFactory.mock.calls.length < 2 && Date.now() - started < 200) {
while (
listenerFactory.mock.calls.length < 2 &&
Date.now() - started < 200
) {
await new Promise((resolve) => setTimeout(resolve, 10));
}
};