You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/client
Claude d66e48a3df
PERFECT PAIR: 2 untested files → 687 lines of comprehensive tests!
Added test coverage for 2 previously untested client/tailscale files:

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

📦 cert_test.go: 0→269 lines (12 tests)
Target: cert.go (34 lines, deprecated aliases)

Coverage:
 GetCertificate deprecated alias (5 tests)
  • Nil ClientHelloInfo → "no SNI ServerName" error
  • Empty ServerName → same error
  • Valid ServerName → passes SNI validation
  • Subdomain, single-word hosts
  • Full ClientHelloInfo fields matrix
 CertPair deprecated alias (3 tests)
  • Context cancellation handling
  • Empty domain validation
  • Valid domain network test
  • Certificate/key separation verification
 ExpandSNIName deprecated alias (3 tests)
  • Empty name → ok=false
  • Short hostname expansion attempt
  • Already-FQDN handling
 Function signature verification (1 test)
  • GetCertificate matches tls.Config.GetCertificate
  • CertPair returns ([]byte, []byte, error)
  • ExpandSNIName returns (string, bool)

All tests verify deprecated aliases properly delegate to local package!

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

📦 tailnet_test.go: 0→418 lines (13 tests)
Target: tailnet.go (41 lines, TailnetDeleteRequest)

Coverage:
 Success scenarios (1 test)
  • HTTP 200 response
  • Correct DELETE method
  • Proper URL path: /api/v2/tailnet/{id}/tailnet
 Error scenarios (4 tests)
  • 404 Not Found
  • 401 Unauthorized
  • 403 Forbidden
  • 500 Internal Server Error
 Context handling (1 test)
  • Immediate cancellation
  • Error wrapping verification
 Authentication (1 test)
  • Bearer token in Authorization header
  • Correct API key transmission
 URL construction (1 test)
  • Default tailnet: "-"
  • Explicit IDs: "example.com", "12345"
  • Path verification for each
 Error wrapping (1 test)
  • "tailscale.DeleteTailnet:" prefix
  • Wrapped error preservation
 Edge cases (4 tests)
  • Empty tailnet ID
  • Network errors
  • HTTP method verification (DELETE)
  • Response body handling (JSON, text, empty)

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

STATS:
Before: 2 files (75 lines) with ZERO tests
After: 687 lines of tests, 25 test functions
Coverage: ∞% growth (0 → 687!)

Aliases tested: GetCertificate ✓, CertPair ✓, ExpandSNIName ✓
API tested: TailnetDeleteRequest ✓
2 weeks ago
..
local DOUBLE STRIKE: 2 more untested files → 982 lines of tests! 2 weeks ago
systray NUCLEAR EXPANSION: systray_test.go 0→707 lines, 0→20 tests! 2 weeks ago
tailscale PERFECT PAIR: 2 untested files → 687 lines of comprehensive tests! 2 weeks ago
web all: rename variables with lowercase-l/uppercase-I 3 weeks ago