fix: enhance authentication error handling in Claude usage service tests

- Updated test to send a specific authentication error pattern to the data callback.
- Triggered the exit handler to validate the handling of authentication errors.
- Improved error message expectations for better clarity during test failures.
This commit is contained in:
Shirone
2026-01-16 23:58:48 +01:00
parent 6bb0461be7
commit cc9f7d48c8

View File

@@ -518,7 +518,11 @@ Resets in 2h
const promise = ptyService.fetchUsageData(); const promise = ptyService.fetchUsageData();
dataCallback!('authentication_error'); // Send data containing the authentication error pattern the service looks for
dataCallback!('"type":"authentication_error"');
// Trigger the exit handler which checks for auth errors
exitCallback!({ exitCode: 1 });
await expect(promise).rejects.toThrow( await expect(promise).rejects.toThrow(
"Claude CLI authentication issue. Please run 'claude logout' and then 'claude login' in your terminal to refresh permissions." "Claude CLI authentication issue. Please run 'claude logout' and then 'claude login' in your terminal to refresh permissions."