Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions archon-ui-main/src/utils/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions archon-ui-main/test/errors.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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', () => {
Expand Down