import {describe,it,expect} from "vitest"; import {classifyTransportError} from "../public/transport-diagnostics.js"; describe("Transport error classification (safe diagnostics)", () => { it.each([ ["Error: TLS connect error (35)","TLS"], ["DNS could not resolve host","DNS"], ["Could not connect to server","TCP/network"], ["Wisp socket closed","WebSocket/Wisp"], ["Internal Service Worker Error","Service worker"], ["Connection timed out","Timeout"], ["Destination rate limited 429","Rate/stream limit"], ["TARGET_BLOCKED 403","Policy/auth"], ["Upstream HTTP status 500","HTTP/application"], ["unrecognized error","Other"], ])("categorizes %s", (message, category) => { const result=classifyTransportError(message); expect(result.category).toBe(category); expect(result.suggestion.length).toBeGreaterThan(8); }); });