From 6d0b9a225fb237923d5446e72d2cb0259a34b641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Thu, 17 Sep 2026 13:12:04 +0200 Subject: [PATCH] v0.2.76 --- tests/connection_status.mjs | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 tests/connection_status.mjs diff --git a/tests/connection_status.mjs b/tests/connection_status.mjs deleted file mode 100644 index d9d88a1..0000000 --- a/tests/connection_status.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import assert from "node:assert/strict"; -import { readFile } from "node:fs/promises"; -import test from "node:test"; - -const connectionStateSource = await readFile(new URL("../static/js/connection-state.js", import.meta.url), "utf8"); -const connectionState = await import(`data:text/javascript;base64,${Buffer.from(connectionStateSource).toString("base64")}`); -const { - CONNECTION_ERROR_AFTER_RECONNECT_ATTEMPTS, - reconnectStatus, -} = connectionState; - -test("temporary reconnects remain reconnecting", () => { - for (let attempt = 0; attempt < CONNECTION_ERROR_AFTER_RECONNECT_ATTEMPTS; attempt += 1) { - assert.equal(reconnectStatus(attempt, true), "reconnecting"); - } -}); - -test("persistent reconnect failures become an error while online", () => { - assert.equal(reconnectStatus(CONNECTION_ERROR_AFTER_RECONNECT_ATTEMPTS, true), "error"); - assert.equal(reconnectStatus(CONNECTION_ERROR_AFTER_RECONNECT_ATTEMPTS + 10, true), "error"); -}); - -test("offline devices stay in reconnecting state instead of a hard error", () => { - assert.equal(reconnectStatus(CONNECTION_ERROR_AFTER_RECONNECT_ATTEMPTS + 10, false), "reconnecting"); -}); - -test("frontend exceptions do not overwrite the connection indicator", async () => { - const editorSource = await readFile(new URL("../static/js/note-editor.js", import.meta.url), "utf8"); - assert.doesNotMatch(editorSource, /setStatus\([^\n]*Application error/); - assert.match(editorSource, /window\.addEventListener\("error", \(\) => notifyFrontendError\(\)\)/); - assert.match(editorSource, /window\.addEventListener\("unhandledrejection", \(\) => notifyFrontendError\(\)\)/); -});