Refine desktop setup and remove bundled app center apps
This commit is contained in:
@@ -13,6 +13,10 @@ vi.mock('@/components/settings/ProvidersSettings', () => ({
|
||||
ProvidersSettings: () => <div data-testid="settings-advanced-model-config-panel">模型配置设置</div>,
|
||||
}));
|
||||
|
||||
vi.mock('@/components/settings/AgentSystemDocumentsSettings', () => ({
|
||||
AgentSystemDocumentsSettings: () => <div data-testid="settings-agent-system-documents-panel">系统文档管理</div>,
|
||||
}));
|
||||
|
||||
vi.mock('@/components/settings/UpdateSettings', () => ({
|
||||
UpdateSettings: () => null,
|
||||
}));
|
||||
@@ -52,9 +56,9 @@ const hotel = {
|
||||
ota: [],
|
||||
};
|
||||
|
||||
function renderRuntimeSettings() {
|
||||
function renderSettings(initialEntry = '/settings/runtime') {
|
||||
return render(
|
||||
<MemoryRouter initialEntries={['/settings/runtime']}>
|
||||
<MemoryRouter initialEntries={[initialEntry]}>
|
||||
<Routes>
|
||||
<Route path="/settings/*" element={<Settings />} />
|
||||
</Routes>
|
||||
@@ -132,7 +136,7 @@ describe('Settings advanced model config', () => {
|
||||
it('keeps model configuration settings inside advanced mode', async () => {
|
||||
useSettingsStore.setState({ devModeUnlocked: true });
|
||||
|
||||
renderRuntimeSettings();
|
||||
renderSettings();
|
||||
|
||||
expect(await screen.findByTestId('settings-model-config-section')).toBeVisible();
|
||||
expect(screen.getByTestId('settings-advanced-model-config-panel')).toHaveTextContent('模型配置设置');
|
||||
@@ -140,9 +144,83 @@ describe('Settings advanced model config', () => {
|
||||
});
|
||||
|
||||
it('keeps model configuration settings hidden until advanced mode is opened', () => {
|
||||
renderRuntimeSettings();
|
||||
renderSettings();
|
||||
|
||||
expect(screen.queryByTestId('settings-model-config-section')).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId('settings-advanced-model-config-panel')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('opens the agent system documents settings tab by route', () => {
|
||||
renderSettings('/settings/system-docs');
|
||||
|
||||
expect(screen.getByText('系统文档')).toBeVisible();
|
||||
expect(screen.getByTestId('settings-agent-system-documents-panel')).toHaveTextContent('系统文档管理');
|
||||
});
|
||||
|
||||
it('shows only the current default model service in diagnostics', async () => {
|
||||
useSettingsStore.setState({ devModeUnlocked: true });
|
||||
hostApiFetchMock.mockImplementation((path: string) => {
|
||||
if (path.startsWith('/api/diagnostics/model-config')) {
|
||||
return Promise.resolve({
|
||||
capturedAt: 1,
|
||||
ok: true,
|
||||
model: {
|
||||
primary: 'deepseek/deepseek-v4-pro',
|
||||
fallbacks: [],
|
||||
providerKey: 'deepseek',
|
||||
modelId: 'deepseek-v4-pro',
|
||||
},
|
||||
runtime: { heartbeatEvery: '0m', heartbeatDisabled: true },
|
||||
providers: [{
|
||||
key: 'deepseek',
|
||||
configured: true,
|
||||
baseUrl: 'https://api.deepseek.com/v1',
|
||||
api: 'openai-completions',
|
||||
timeoutSeconds: null,
|
||||
authHeader: null,
|
||||
modelCount: 1,
|
||||
}],
|
||||
authProfiles: {
|
||||
path: '',
|
||||
exists: true,
|
||||
providers: [{
|
||||
provider: 'deepseek',
|
||||
profileCount: 1,
|
||||
profileIds: ['deepseek:default'],
|
||||
types: ['api_key'],
|
||||
hasDefaultProfile: true,
|
||||
lastGoodProfileId: 'deepseek:default',
|
||||
}],
|
||||
},
|
||||
checks: [
|
||||
{ id: 'primary-model', label: '默认模型', status: 'ok', detail: 'deepseek/deepseek-v4-pro' },
|
||||
{ id: 'provider-entry', label: '模型服务', status: 'ok', detail: '已配置 deepseek' },
|
||||
{ id: 'auth-profile', label: '调用凭据', status: 'ok', detail: '已找到 deepseek 的本地凭据' },
|
||||
],
|
||||
paths: { openclawConfig: '', authProfiles: '' },
|
||||
});
|
||||
}
|
||||
if (path.startsWith('/api/diagnostics/office-runtime')) {
|
||||
return Promise.resolve({
|
||||
capturedAt: 1,
|
||||
ok: true,
|
||||
repairAttempted: false,
|
||||
python: { executable: null, packages: [] },
|
||||
node: { modules: [] },
|
||||
dotnet: { available: false, version: null },
|
||||
checks: [],
|
||||
});
|
||||
}
|
||||
return Promise.resolve({});
|
||||
});
|
||||
|
||||
renderSettings();
|
||||
|
||||
expect(await screen.findByText('deepseek/deepseek-v4-pro')).toBeVisible();
|
||||
expect(screen.getByText('当前模型服务')).toBeVisible();
|
||||
expect(screen.getAllByText('deepseek').length).toBeGreaterThan(0);
|
||||
expect(screen.queryByText('yinian-model')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('minimax')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('minimax-portal')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user