Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: cover embedding model refresh responses (#6703)

[._.]/ Adam Eivy0e81bf58040c
diff --git a/client/src/components/settings/EmbeddingsTab.test.jsx b/client/src/components/settings/EmbeddingsTab.test.jsx
index 8acc7d1bdc..63a112bb42 100644
--- a/client/src/components/settings/EmbeddingsTab.test.jsx
+++ b/client/src/components/settings/EmbeddingsTab.test.jsx
@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from 'vitest';
-import { render, screen, waitFor } from '@testing-library/react';
+import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { MemoryRouter } from 'react-router';
vi.mock('../../services/apiSystem', () => ({
@@ -7,10 +7,9 @@ vi.mock('../../services/apiSystem', () => ({
updateSettings: vi.fn(),
}));
vi.mock('../../services/apiLocalLlm', () => ({
- getLocalLlmStatus: vi.fn().mockResolvedValue({
- ollama: { models: [{ id: 'nomic-embed-text' }] },
- lmstudio: { models: [] },
- }),
+ getLocalLlmStatus: vi.fn()
+ .mockResolvedValueOnce({ ollama: { models: [{ id: 'custom-embed:latest' }] }, lmstudio: { models: [] } })
+ .mockResolvedValueOnce({ ollama: { models: [] }, lmstudio: { models: [{ id: 'example/custom-embedding' }] } }),
}));
vi.mock('../ui/Toast', () => ({
default: Object.assign(vi.fn(), { success: vi.fn(), error: vi.fn() }),
@@ -19,9 +18,14 @@ vi.mock('../ui/Toast', () => ({
import EmbeddingsTab from './EmbeddingsTab.jsx';
describe('EmbeddingsTab', () => {
- it('reads installed embedding choices from the public models field', async () => {
+ it('reads installed embedding choices from the public models field for both backends', async () => {
render(<MemoryRouter><EmbeddingsTab /></MemoryRouter>);
- await waitFor(() => expect(screen.getByRole('option', { name: 'nomic-embed-text' })).toBeInTheDocument());
+ const datalist = () => document.getElementById('embeddings-model-options');
+ await waitFor(() => expect(datalist().querySelector('option[value="custom-embed:latest"]')).toBeTruthy());
+
+ fireEvent.change(screen.getByLabelText('Provider'), { target: { value: 'lmstudio' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Refresh' }));
+ await waitFor(() => expect(datalist().querySelector('option[value="example/custom-embedding"]')).toBeTruthy());
});
});