Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e93560eb1 |
@@ -24,14 +24,14 @@ Run `make frontend-viewport-test` in CI as its own step; it is not part of
|
||||
- 2026-10-18: a browser that cannot format the header's clocks still probes
|
||||
([#149](https://git.eeqj.de/sneak/netwatch/issues/149)). The clocks name the
|
||||
local time zone through `Intl.DateTimeFormat`'s `shortGeneric` option, which
|
||||
browsers from before 2022 reject with an error; it came before the first round
|
||||
started, so such a browser never checked a target. The clocks now start last,
|
||||
after the rounds, and an error formatting them leaves both blank. The footer's
|
||||
color legend reads `>=500ms` for red, where it read `>500ms`, so 500 ms, which
|
||||
is red, is in one of its colors
|
||||
Chrome before 95, Firefox before 91 and Safari before 15.4 reject with an
|
||||
error; it came before the first round started, so such a browser never checked
|
||||
a target. The clocks now start last, after the rounds, and an error formatting
|
||||
them leaves both blank. The footer's color legend reads `>=500ms` for red,
|
||||
where it read `>500ms`, so 500 ms, which is red, is in one of its colors
|
||||
([#152](https://git.eeqj.de/sneak/netwatch/issues/152)). Unit tests check the
|
||||
clocks with a working `Intl.DateTimeFormat` and with one that rejects
|
||||
`shortGeneric`, and draw the page and check the legend's limits against
|
||||
`shortGeneric`, and draw the page and check the legend against every entry of
|
||||
`CONFIG.latencyColors`
|
||||
- 2026-10-18: from a trusted proxy, the backend takes the client address from
|
||||
the right-most `X-Forwarded-For` entry that is not in `TRUSTED_PROXIES`
|
||||
|
||||
+13
-11
@@ -588,9 +588,12 @@ test("a check that timed out or found its target unreachable has a grey figure a
|
||||
// buildUI draws the page into #app, here a plain object. Each entry in the
|
||||
// footer's color legend is a colored dot and the latencies it stands for,
|
||||
// with < and > written as < and >. A latency takes the color of the
|
||||
// first entry in CONFIG.latencyColors whose limit it is below, so red, the
|
||||
// last, starts at orange's limit.
|
||||
test("the footer's color legend gives the latency limits in CONFIG.latencyColors, each latency in one color", (t) => {
|
||||
// first entry in CONFIG.latencyColors whose limit it is below, so the
|
||||
// legend has, for each of those entries in order, a dot of its color (a
|
||||
// bg- class where CONFIG.latencyColors has a text- one) and the latencies
|
||||
// below its limit, or, for the last, which has no limit, the latencies
|
||||
// from the limit before it up. A gray dot for offline comes after them.
|
||||
test("the footer's color legend has each entry in CONFIG.latencyColors, with its color and limit, then offline", (t) => {
|
||||
const app = {};
|
||||
t.mock.method(globalThis.document, "getElementById", () => app);
|
||||
buildUI(new AppState([]));
|
||||
@@ -598,15 +601,14 @@ test("the footer's color legend gives the latency limits in CONFIG.latencyColors
|
||||
const legend = [
|
||||
...app.innerHTML.matchAll(/(bg-\w+-500) [^"]*"><\/span>(\S+)/g),
|
||||
].map(([, dot, latencies]) => [dot, latencies]);
|
||||
const limits = CONFIG.latencyColors.map((color) => color.below);
|
||||
assert.deepEqual(legend, [
|
||||
["bg-green-500", `<${limits[0]}ms`],
|
||||
["bg-lime-500", `<${limits[1]}ms`],
|
||||
["bg-yellow-500", `<${limits[2]}ms`],
|
||||
["bg-orange-500", `<${limits[3]}ms`],
|
||||
["bg-red-500", `>=${limits[3]}ms`],
|
||||
["bg-gray-500", "offline"],
|
||||
const colors = CONFIG.latencyColors;
|
||||
const expected = colors.map((color, i) => [
|
||||
color.className.replace("text-", "bg-"),
|
||||
color.below === Infinity
|
||||
? `>=${colors[i - 1].below}ms`
|
||||
: `<${color.below}ms`,
|
||||
]);
|
||||
assert.deepEqual(legend, [...expected, ["bg-gray-500", "offline"]]);
|
||||
});
|
||||
|
||||
// A target whose checks, in turn, answered after each of latencies ms, or,
|
||||
|
||||
Reference in New Issue
Block a user