diff --git a/archon-ui-main/src/utils/onboarding.ts b/archon-ui-main/src/utils/onboarding.ts index 743566f2b5..93f082cc0b 100644 --- a/archon-ui-main/src/utils/onboarding.ts +++ b/archon-ui-main/src/utils/onboarding.ts @@ -41,10 +41,11 @@ export function isLmConfigured( // Helper function to check if a credential has a valid value const hasValidCredential = (cred: NormalizedCredential | undefined): boolean => { if (!cred) return false; - return !!( - (cred.value && cred.value !== 'null' && cred.value !== null && cred.value.trim() !== '') || - (cred.is_encrypted && cred.encrypted_value && cred.encrypted_value !== 'null' && cred.encrypted_value !== null) - ); + // If is_encrypted is true, we consider it valid even without a value, + // as the value is stored on the server. + if (cred.is_encrypted) return true; + + return !!(cred.value && cred.value !== 'null' && cred.value !== null && cred.value.trim() !== ''); }; // Find API keys diff --git a/archon-ui-main/test/errors.test.tsx b/archon-ui-main/test/errors.test.tsx index 7ec739eff2..9b0b680329 100644 --- a/archon-ui-main/test/errors.test.tsx +++ b/archon-ui-main/test/errors.test.tsx @@ -35,7 +35,8 @@ describe('Error Handling Tests', () => { expect(screen.getByRole('alert')).toHaveTextContent('Failed to load data') }) - test('timeout error simulation', () => { + test('timeout error simulation', async () => { + vi.useFakeTimers() const MockTimeoutComponent = () => { const [status, setStatus] = React.useState('idle') @@ -60,10 +61,14 @@ describe('Error Handling Tests', () => { fireEvent.click(screen.getByText('Start Request')) expect(screen.getByText('Loading...')).toBeInTheDocument() - // Wait for timeout - setTimeout(() => { - expect(screen.getByRole('alert')).toHaveTextContent('Request timed out') - }, 150) + // Fast-forward time + await act(async () => { + await vi.advanceTimersByTimeAsync(150) + }) + + const alert = await screen.findByRole('alert') + expect(alert).toHaveTextContent('Request timed out') + vi.useRealTimers() }) test('form validation errors', () => {