Skip to content

[Repo Assist] test: expand WindowsNodeClient coverage with 10 new unit tests - #157

Merged
shanselman merged 1 commit into
masterfrom
repo-assist/test-windows-node-client-20260408-3bc558375b39eebf
Apr 8, 2026
Merged

shanselman merged 1 commit into
masterfrom
repo-assist/test-windows-node-client-20260408-3bc558375b39eebf

Conversation

@github-actions

@github-actions github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

WindowsNodeClientTests.cs had only 3 tests (2 Facts + 1 Theory with 3 inline cases) for a class with significant branching logic. This PR adds 10 new tests covering previously untested code paths.

New test coverage

Test What it exercises
HandleResponse_HelloOkWithStoredToken_FiresPairedOnceNotPending When a device token is already stored and hello-ok arrives, exactly one Paired event fires (not Pending → Paired)
HandleResponse_FailedRegistration_RaisesConnectionError ok: false from gateway raises ConnectionStatus.Error
HandleResponse_MissingPayload_DoesNotThrow Response with no payload property doesn't crash
ShortDeviceId_LongId_TruncatesTo16Chars 64-char DeviceId is truncated to a 16-char prefix
IsPaired_ReturnsFalse_WhenNoStoredToken Fresh client reports IsPaired = false
IsPaired_ReturnsTrue_AfterDeviceTokenStored After StoreDeviceToken, IsPaired = true
RegisterCapability_AddsToCapabilitiesListAndRegistration Capability appears in client.Capabilities
RegisterCapability_DeduplicatesCommandsAndCategories Registering two capabilities with the same category adds the category only once to NodeRegistration
IsPendingApproval_FalseInitially New client is not in pending-approval state
FullDeviceId_IsNonEmpty FullDeviceId is non-empty after construction

Test Status

Passed! – Shared.Tests: 535 passed, 20 skipped (was 525)  ✅
Passed! – Tray.Tests:    99 passed,  0 skipped             ✅

All 10 new tests pass. No existing tests broken.

Generated by Repo Assist · ◷

To install this agentic workflow, run

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

Adds tests for previously uncovered scenarios:
- HandleResponse with stored device token fires Paired (not Pending)
- HandleResponse with ok:false raises ConnectionStatus.Error
- HandleResponse with missing payload does not throw
- ShortDeviceId truncates to 16-char prefix of FullDeviceId
- IsPaired returns false when no device token stored
- IsPaired returns true after device token stored
- RegisterCapability adds to Capabilities list and Registration
- RegisterCapability deduplicates categories in NodeRegistration
- IsPendingApproval is false initially
- FullDeviceId is non-empty after construction

Co-authored-by: Copilot <[email protected]>
@shanselman
shanselman marked this pull request as ready for review April 8, 2026 20:09
@shanselman
shanselman merged commit 5b57ebd into master Apr 8, 2026
@shanselman
shanselman deleted the repo-assist/test-windows-node-client-20260408-3bc558375b39eebf branch April 8, 2026 20:09
@github-actions github-actions Bot mentioned this pull request Apr 9, 2026
12 tasks
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