sotashimozono
|
bb5e0f5f0d
|
test: AuthResolver / ConflictResolver / ReconnectManager branch coverage (#261)
* test: AuthResolver / ConflictResolver / ReconnectManager branch coverage
Add tests for three modules not touched by PR #257:
tests/AuthResolver.test.ts (new):
- storeSecret / getSecret / persistSecret / clearSecrets session-map API
- buildAuthConfig for password, privateKey (+ passphrase / ENOENT / ~/ expand),
agent (agentSocket / SSH_AUTH_SOCK fallback / missing socket), unknown method
tests/ConflictResolver.test.ts (new):
- keep-theirs decision (lines 74-78 previously uncovered)
- cancel decision (line 84)
- re-read failure fallback (line ~50)
- swapClient(), two-choice fallback, three-way merge paths
tests/ReconnectManager.test.ts (extended, 2 new tests):
- onState throws → loop continues (transition() catch block)
- cancel race: timer fires after cancel() sets cancelled flag (lines 133-134)
vitest.config.ts: raise thresholds to lines:76 / branches:70 / functions:71
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fixup! test(AuthResolver/ReconnectManager): cross-platform paths + microtask comment
AuthResolver.test.ts (review: HIGH — POSIX path convention):
* Replace /home/alice/.ssh/id_ed25519 with ~/.ssh/id_ed25519 — also
exercises expandHome, and avoids hardcoding a user-home path
* Replace /nonexistent/key with nonexistent-key (readFileSync is mocked,
path value is irrelevant but should not imply POSIX-only)
* Replace /run/user/1000/ssh-agent.socket with test-ssh-agent.socket
* Replace /tmp/ssh-auth.sock with test-ssh-auth.sock
ReconnectManager.test.ts (review: advisory — fragile assumption):
* Document the one-microtask assumption in the race test so future
refactors that add an await before sleep() know to update the test
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-05-09 22:21:22 +09:00 |
|