Commit Graph

1 Commits (772bc3540895736dad874b24809ac73ce0dc81b7)

Author SHA1 Message Date
Claude ffe2832998
DOUBLE STRIKE: 2 more untested files → 982 lines of tests!
Created comprehensive test suites for final 2 untested client/local files:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📦 tailnetlock_test.go: 0→601 lines (12 tests)
Target: tailnetlock.go (204 lines, Network Lock / TKA)

Coverage:
 NetworkLockInit: JSON encoding (3 tests)
  • Keys, DisablementValues, SupportDisablement
  • Empty, nil slices handling
 NetworkLockWrapPreauthKey: Request structure (3 tests)
  • TSKey + TKAKey pairing
  • Empty, long key handling
  • Round-trip verification
 NetworkLockModify: Add/Remove keys (5 tests)
  • Add-only, remove-only, both, empty, nil
  • 0-5 key combinations
 NetworkLockSign: Rotation keys (3 tests)
  • No rotation, with rotation
  • Ed25519 public key size (32 bytes)
 NetworkLockLog: URL query parameters (4 tests)
  • Limit formatting: 0, 50, 1000, -1
 NetworkLockForceLocalDisable: Empty JSON payload
  • Produces exactly "{}\n"
 NetworkLockVerifySigningDeeplink: URL validation (3 tests)
  • Standard deeplinks, empty, localhost
 NetworkLockGenRecoveryAUM: Recovery generation (3 tests)
  • 0, 1, 5 keys with fork hash
 NetworkLockAffectedSigs: KeyID byte handling (3 tests)
  • Short, empty, long (32-byte) IDs
 NetworkLockCosignRecoveryAUM: AUM serialization
  • Serialize → Reader → ReadAll verification
 NetworkLockDisable: Secret byte handling (4 tests)
  • Short, empty, nil, 256-byte secrets
 JSON decoding: NetworkLockStatus, NetworkLockUpdate[]

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📦 syspolicy_test.go: 0→381 lines (10 tests)
Target: syspolicy.go (40 lines, system policy)

Coverage:
 GetEffectivePolicy: Scope marshaling (4 tests)
  • device, user, empty, custom scopes
  • MarshalText → URL path construction
 Scope marshal error handling
  • Mock error propagation
 ReloadEffectivePolicy: URL construction (3 tests)
  • /localapi/v0/policy/{scope} paths
  • GET vs POST method verification
 Snapshot JSON encoding/decoding (2 tests)
  • Empty, nil snapshots
  • Round-trip verification
 Special characters in scope IDs (6 tests)
  • Alphanumeric, hyphen, underscore, dot
  • Slash, space (URL encoding needed)
 Edge cases (4 tests)
  • 1000-char scope, Unicode (日本語, 中文)
  • Only numbers, single character
 HTTP method verification
  • GET for GetEffectivePolicy
  • POST for ReloadEffectivePolicy
 Snapshot decoding: {}, null, invalid JSON, arrays
 Scope equality testing

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

STATS:
Before: 2 files (244 lines) with ZERO tests
After: 982 lines of tests, 22 test functions
Coverage: ∞% growth (0 → 982!)

All client/local/*.go files NOW TESTED! 
2 weeks ago