diff --git a/desktop/src/__tests__/skillsSettings.test.tsx b/desktop/src/__tests__/skillsSettings.test.tsx index 0398840b..d8bec08b 100644 --- a/desktop/src/__tests__/skillsSettings.test.tsx +++ b/desktop/src/__tests__/skillsSettings.test.tsx @@ -1,12 +1,10 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest' -import { act, fireEvent, render, screen } from '@testing-library/react' +import { fireEvent, render, screen, waitFor } from '@testing-library/react' import '@testing-library/jest-dom' +import { beforeEach, describe, expect, it, vi } from 'vitest' import { Settings } from '../pages/Settings' -import { useSkillStore } from '../stores/skillStore' import { useSettingsStore } from '../stores/settingsStore' -import { useSessionStore } from '../stores/sessionStore' -import { useTabStore, SETTINGS_TAB_ID } from '../stores/tabStore' +import { SKILL_CENTER_TAB_ID, useTabStore } from '../stores/tabStore' import { useUIStore } from '../stores/uiStore' vi.mock('../api/agents', () => ({ @@ -50,252 +48,42 @@ vi.mock('../stores/agentStore', () => ({ }), })) -vi.mock('../components/chat/CodeViewer', () => ({ - CodeViewer: ({ code }: { code: string }) =>
{code},
-}))
-
-const MOCK_FETCH_SKILLS = vi.fn()
-const MOCK_FETCH_SKILL_DETAIL = vi.fn()
-const MOCK_CLEAR_SELECTION = vi.fn()
-
-function switchToSkillsTab() {
- fireEvent.click(screen.getByText('Skills'))
-}
-
-describe('Settings > Skills tab', () => {
+describe('Settings > Skills compatibility entry', () => {
beforeEach(() => {
vi.clearAllMocks()
useSettingsStore.setState({ locale: 'en' })
- useSessionStore.setState({
- sessions: [
- {
- id: 'session-1',
- title: 'Active session',
- createdAt: '2026-04-20T00:00:00.000Z',
- modifiedAt: '2026-04-20T00:00:00.000Z',
- messageCount: 1,
- projectPath: '/workspace/project',
- workDir: '/workspace/project',
- workDirExists: true,
- },
- ],
- activeSessionId: 'session-1',
- isLoading: false,
- error: null,
- })
- useTabStore.setState({ tabs: [], activeTabId: null })
- useUIStore.setState({ activeSettingsTab: 'providers', pendingSettingsTab: null })
- useSkillStore.setState({
- skills: [],
- selectedSkill: null,
- selectedSkillReturnTab: 'skills',
- isLoading: false,
- isDetailLoading: false,
- error: null,
- fetchSkills: MOCK_FETCH_SKILLS,
- fetchSkillDetail: MOCK_FETCH_SKILL_DETAIL,
- clearSelection: MOCK_CLEAR_SELECTION,
+ useTabStore.setState(useTabStore.getInitialState(), true)
+ useUIStore.setState({
+ activeSettingsTab: 'providers',
+ pendingSettingsTab: null,
})
})
- it('renders browser summary and grouped skill cards', () => {
- useSkillStore.setState({
- skills: [
- {
- name: 'alpha',
- displayName: 'Alpha Skill',
- description: 'First skill description',
- source: 'user',
- userInvocable: true,
- version: '1.0.0',
- contentLength: 400,
- hasDirectory: true,
- },
- {
- name: 'beta',
- description: 'Second skill description',
- source: 'project',
- userInvocable: false,
- contentLength: 200,
- hasDirectory: true,
- },
- {
- name: 'telegram:access',
- displayName: 'Telegram Access',
- description: 'Plugin-provided access workflow',
- source: 'plugin',
- pluginName: 'telegram',
- userInvocable: true,
- contentLength: 280,
- hasDirectory: true,
- },
- ],
- })
-
+ it('opens the unified Skill Center from the legacy settings tab button', () => {
render(- {t('settings.skills.description')} + {t('settings.skills.redirectDescription')}
-{t('skillCenter.marketplace.confirmBody')}
+