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.
15 lines
548 B
JavaScript
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");
|
|
});
|