Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/frontend/packages/swarm-ui/test/stream-connection.test.mjs
iris 31b7452e56 swarm-ui: let a closed stream reconnect and a failed caps read retry
When the server answers an event stream with an error status the browser
gives up and the badge stayed on disconnected with nothing to press. The
terminal, its state header and the messages page now offer a reconnect,
and the one rule for the state after an error moved into a tested helper.
The resource caps panel gets a retry beside its error, and its loading
state announces itself.
2026-10-22 07:13:32 +02:00

15 lines
548 B
JavaScript

import { test } from "node:test";
import assert from "node:assert/strict";
import { connectionAfterError } from "../src/ui/stream/connection.ts";
test("connectionAfterError: the browser still retrying is reconnecting", () => {
assert.equal(connectionAfterError(0), "reconnecting");
});
test("connectionAfterError: a given-up stream is closed", () => {
assert.equal(connectionAfterError(2), "closed");
});
test("connectionAfterError: an open readyState on error is also closed", () => {
assert.equal(connectionAfterError(1), "closed");
});