Skip to content

[Repo Assist] test(tray): add unit tests for NodeCapabilityGating.GetLocalNodeCapabilities - #495

Merged
shanselman merged 1 commit into
masterfrom
repo-assist/test-node-capability-gating-798a50894d4678b9
May 21, 2026
Merged

[Repo Assist] test(tray): add unit tests for NodeCapabilityGating.GetLocalNodeCapabilities#495
shanselman merged 1 commit into
masterfrom
repo-assist/test-node-capability-gating-798a50894d4678b9

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated pull request from Repo Assist.

What

Adds 8 unit tests for NodeCapabilityGating.GetLocalNodeCapabilities, a pure helper function that was introduced alongside the system-run permissions toggle but had no test coverage.

Why

GetLocalNodeCapabilities is used by the tray menu, instances page, connection page, and permissions page to resolve the local node's capability list. Regressions here could silently cause capabilities to appear/disappear across surfaces. The tests lock in the null-guard contracts, case-insensitive ID matching, and return-value semantics.

Tests added

Test Purpose
NullNodes_ReturnsNull null nodes → null
EmptyNodes_ReturnsNull empty array → null
NullDeviceId_ReturnsNull null device id → null
EmptyDeviceId_ReturnsNull empty device id → null
NoMatchingNode_ReturnsNull id not in list → null
MatchingNode_ReturnsCapabilities exact match → capability list
MatchingNodeCaseInsensitive_ReturnsCapabilities mixed-case id → match
NodeWithNoCapabilities_ReturnsEmptyList empty capabilities → empty list (not null)

Test Status

dotnet test ./tests/OpenClaw.Tray.Tests --filter NodeCapabilityGating
Passed! - Failed: 0, Passed: 17, Skipped: 0, Total: 17

All 9 pre-existing tests + 8 new tests pass. Pre-existing failures in LocalGatewaySetupTests are infrastructure-only (WSL not available in CI) and unrelated to this PR.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@97143ac59cb3a13ef2a77581f929f06719c7402a

…ilities

Add 8 tests covering the null-guard, case-insensitive lookup, and
return-value contracts of the untested GetLocalNodeCapabilities helper.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@shanselman
shanselman marked this pull request as ready for review May 21, 2026 20:00
@shanselman
shanselman merged commit e0224e3 into master May 21, 2026
7 checks passed
@shanselman
shanselman deleted the repo-assist/test-node-capability-gating-798a50894d4678b9 branch May 21, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant