Compare commits

..

2 Commits

Author SHA1 Message Date
you
9f230b947b fix: remove duplicate _nodesSortArrow export in nodes.js 2026-04-02 08:09:48 +00:00
you
ce23bea0ce test: add P0 coverage for nodes.js — sort, status, timestamps, sync
Part of #344 — nodes.js coverage

Add 67 new tests for nodes.js covering:
- toggleSort: direction toggling, default directions per column, persistence
- sortNodes: all 5 column types (name, public_key, role, last_seen, advert_count),
  both directions, case-insensitivity, unnamed-last behavior, timestamp fallbacks
- sortArrow: active/inactive column rendering
- syncClaimedToFavorites: adding claimed nodes, no-op when synced, edge cases
- renderNodeTimestampHtml/Text: tooltip rendering, future timestamps, null handling
- getStatusInfo edge cases: _lastHeard priority, all role thresholds (room 72h,
  sensor 24h), explanation text for active/stale states, unknown role fallback
- getStatusTooltip: all role/status combinations

Expose test hooks on window for toggleSort, sortNodes, sortArrow,
getSortState, setSortState, syncClaimedToFavorites, renderNodeTimestampHtml,
renderNodeTimestampText.

All 300 frontend helper tests pass (was 233).
2026-04-02 08:06:12 +00:00
2 changed files with 480 additions and 532 deletions

View File

@@ -959,4 +959,12 @@
window._nodesIsAdvertMessage = isAdvertMessage;
window._nodesGetAllNodes = function() { return _allNodes; };
window._nodesSetAllNodes = function(n) { _allNodes = n; };
window._nodesToggleSort = toggleSort;
window._nodesSortNodes = sortNodes;
window._nodesSortArrow = sortArrow;
window._nodesGetSortState = function() { return sortState; };
window._nodesSetSortState = function(s) { sortState = s; };
window._nodesSyncClaimedToFavorites = syncClaimedToFavorites;
window._nodesRenderNodeTimestampHtml = renderNodeTimestampHtml;
window._nodesRenderNodeTimestampText = renderNodeTimestampText;
})();

File diff suppressed because it is too large Load Diff