The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(ai): add tests for managed model source in provider picker\n\nAdd test coverage for the managed model source being offered first and selectable without a model id, and for being omitted when the host opts out. The existing test for selecting a specific model is also updated to first click the provider button, matching the actual user flow now that managed is the default source.\n\nAuto-committed-on: macbook\n
Steven Enamakel0befef7b0f66
diff --git a/app/src/components/settings/panels/ai/ProviderModelPickerDialog.test.tsx b/app/src/components/settings/panels/ai/ProviderModelPickerDialog.test.tsxindex 2cca9e8440..8993445b2b 100644--- a/app/src/components/settings/panels/ai/ProviderModelPickerDialog.test.tsx+++ b/app/src/components/settings/panels/ai/ProviderModelPickerDialog.test.tsx@@ -34,6 +34,10 @@ describe('ProviderModelPickerDialog', () => {/>);+ // Managed is the first source now, so reaching a provider's catalog means+ // selecting that provider — the same step a user takes.+ fireEvent.click(screen.getByRole('button', { name: /OpenAI/ }));+fireEvent.change(await screen.findByRole('combobox', { name: 'Model' }), {target: { value: 'gpt-4o-mini' },});@@ -47,4 +51,58 @@ describe('ProviderModelPickerDialog', () => {}));});++ /**+ * Managed must be reachable from every model picker. Without it, choosing any+ * specific model was a one-way door: nothing in the UI routed back to the+ * product's own model selection.+ */+ it('offers managed first and selects it without requiring a model id', async () => {+ const onSelect = vi.fn();++ render(+ <ProviderModelPickerDialog+ cloudProviders={[]}+ localModels={[]}+ ollamaRunning={false}+ claudeCodeEnabled={false}+ initial={null}+ onClose={() => {}}+ onSelect={onSelect}+ />+ );++ // Preselected, and its pane explains the choice rather than asking for one.+ expect(screen.getByTestId('model-picker-managed-pane')).toBeInTheDocument();+ expect(screen.queryByRole('combobox', { name: 'Model' })).toBeNull();++ const submit = screen.getByRole('button', { name: 'Use this model' });+ expect(submit).not.toBeDisabled();+ fireEvent.click(submit);++ await waitFor(() =>+ expect(onSelect).toHaveBeenCalledWith({+ source: { kind: 'managed' },+ model: '',+ contextWindow: null,+ })+ );+ });++ it('omits managed when the host opts out', () => {+ render(+ <ProviderModelPickerDialog+ allowManaged={false}+ cloudProviders={[]}+ localModels={[]}+ ollamaRunning={false}+ claudeCodeEnabled={false}+ initial={null}+ onClose={() => {}}+ onSelect={() => {}}+ />+ );++ expect(screen.queryByTestId('model-picker-managed-pane')).toBeNull();+ });});