Files
OmniRoute/tests/unit/connection-row-last-error-visibility.test.ts
Diego Rodrigues de Sa e Souza d0396c200d Release v3.8.31 (#4377)
Release v3.8.31 — see CHANGELOG.md [3.8.31] for full notes and contributors.

Merged over known non-blocking reds (all correctness gates green): Integration Tests (2/2) is env/flaky (polls a real upstream batch that did not complete in the poll window); SonarQube/SonarCloud is the advisory server-side new-code quality gate. Unit (8 shards), Coverage, Node 22/24/26, Lint, PR Test Policy, Quality Ratchet, Docs-Strict, Quality-Extended and all 4 CodeQL analyses are green.
2026-06-20 14:55:24 -03:00

30 lines
1.2 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
// Regression for port-from-9router#1447: a disabled connection's lastError was hidden
// in the connection row (`connection.isActive !== false` gated it), yet the provider
// card's error badge still counts disabled-with-error rows. The operator could see the
// error count but not the cause. The row now shows the error whenever there is one.
const { shouldShowConnectionLastError } = await import(
"../../src/app/(dashboard)/dashboard/providers/[id]/components/connectionRowHelpers.ts"
);
test("#1447: lastError is shown even when the connection is disabled", () => {
assert.equal(
shouldShowConnectionLastError({ lastError: "401 Unauthorized", isActive: false }),
true
);
});
test("#1447: lastError is shown for an active connection", () => {
assert.equal(
shouldShowConnectionLastError({ lastError: "429 Too Many Requests", isActive: true }),
true
);
});
test("#1447: nothing is shown when there is no lastError", () => {
assert.equal(shouldShowConnectionLastError({ isActive: false }), false);
assert.equal(shouldShowConnectionLastError({ lastError: "", isActive: true }), false);
});