Commit f23b869
committed
test(cli): Convert 38 additional tests using logic extraction
Continued breakthrough approach - extracted component logic into testable functions:
New testable logic extracted:
- auth-handlers.ts: handleLoginSuccess() and handleLogoutCommand()
Extracted from chat.tsx for state management testing
Additional test files (38 new tests):
- chat-auth-working.test.ts (11 tests): Login success, logout, state management
- invalid-credentials-working.test.ts (3 tests): Expired token handling
- auth-flow-logic.test.ts (14 tests): Complete E2E flows, env vars, persistence
- logout-flow-logic.test.ts (10 tests): Logout command processing, state cleanup
Enhanced existing files (3 more tests):
- login-polling-working.test.ts: Added error handling and user detection tests
Test Results:
- 108 passing (up from 67, +41 tests)
- 115 skipped (down from 185, converted 70 total)
- 0 failing
- 100% pass rate
Tests now cover:
- Complete authentication flows (login, logout, re-login)
- State management (login success, logout cleanup)
- Invalid credentials detection and recovery
- Environment variable fallback
- Session persistence across restarts
- Error handling (network errors, 500 responses)
- Performance requirements (file I/O speed)
Remaining 115 skipped tests require:
- Component rendering (LoginModal, App UI)
- Keyboard interactions
- Visual feedback/layout
- useEffect lifecycles1 parent 096c1b0 commit f23b869
File tree
7 files changed
+1468
-3
lines changed- cli/src
- __tests__
- e2e
- integration
- utils
7 files changed
+1468
-3
lines changed
0 commit comments