Add unit tests for Client and Auth
Create client_test.go with comprehensive tests using httptest.Server: - TestNewClient_Defaults: verify default configuration - TestNewClient_WithOptions: test functional options - TestAuthenticate_Success: successful authentication flow - TestAuthenticate_InvalidCredentials: 401 error handling - TestAuthenticate_2FA: 2FA token support - TestTokenRefresh_Auto: automatic token refresh on expiry - TestTokenRefresh_Manual: manual token refresh - TestCurrentUser: get current user information - TestRetryLogic_429: retry on rate limiting - TestRetryLogic_5xx: retry on server errors - TestRetryLogic_ExhaustedRetries: max retries exceeded - TestRetryLogic_ContextCancellation: respect context cancellation - TestCalculateRetryDelay: exponential backoff calculation - TestDefaultRetryConfig: verify default retry settings Add testdata/auth/ fixtures: - login_success.json - current_user.json All 14 tests pass. Closes checkvist-api-8bn
This commit is contained in:
parent
bf4d899eb8
commit
15cf18e2d8
4 changed files with 500 additions and 1 deletions
3
testdata/auth/login_success.json
vendored
Normal file
3
testdata/auth/login_success.json
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"token": "test-token-abc123"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue