mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
Settings collaboration direction (recorded in the note): the shell only provides composition faces — feature plugins register themselves. The General section moves into the ui-settings shell (order 0, skeleton rows) and declares the settings.general.item list slot; locale registers the Language row and ui-theme the Appearance row (each with its own store mirror, dictionaries, and ledger-judged deferral); the ui-settings-general package is gone. ui-settings-models becomes ui-models — a feature package that contributes its Settings section rather than a settings-owned satellite. The item-slot SlotMap entry is authored in the ui-settings contract and repeated verbatim in locale/ui-theme (reference-cycle avoidance; declaration merging keeps the copies identical).
48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
import { cleanup, render, screen } from '@testing-library/react'
|
|
import type { GeneralSectionComponentProps } from '../src/client/contract/slots.ts'
|
|
import { GeneralSection } from '../src/client/GeneralSection.tsx'
|
|
import { en } from '../src/client/locales.ts'
|
|
|
|
afterEach(cleanup)
|
|
|
|
function mount() {
|
|
const renderSlot = vi.fn(
|
|
((key: string) => <div data-testid={`slot-${key}`} />) as GeneralSectionComponentProps['renderSlot'],
|
|
)
|
|
const props: GeneralSectionComponentProps = {
|
|
t: (key) => en[key] ?? key,
|
|
renderSlot,
|
|
}
|
|
const view = render(<GeneralSection {...props} />)
|
|
return { view, renderSlot }
|
|
}
|
|
|
|
describe('GeneralSection', () => {
|
|
it('renders the Permission skeleton row with the disabled selector', () => {
|
|
mount()
|
|
expect(screen.getByText('Permission')).toBeTruthy()
|
|
expect(screen.getByText('Choose default permission mode')).toBeTruthy()
|
|
const selector = screen.getByRole('button', { name: /Read only/ }) as HTMLButtonElement
|
|
expect(selector.disabled).toBe(true)
|
|
})
|
|
|
|
it('renders the Tool Call skeleton cubes with schema pinned selected', () => {
|
|
mount()
|
|
expect(screen.getByText('Tool Call')).toBeTruthy()
|
|
const schema = screen.getByText('Schema mode')
|
|
const code = screen.getByText('Code mode')
|
|
expect(schema.parentElement!.className).toContain('selected')
|
|
expect(code.parentElement!.className).not.toContain('selected')
|
|
expect(screen.getByText('Traditional function calling — invoke tools one at a time')).toBeTruthy()
|
|
expect(screen.getByText('Chain multiple tools with code — multi-step orchestration')).toBeTruthy()
|
|
})
|
|
|
|
it('renders the feature-contributed item slot after the skeleton rows', () => {
|
|
const { renderSlot } = mount()
|
|
expect(renderSlot).toHaveBeenCalledWith('settings.general.item', {})
|
|
expect(screen.getByTestId('slot-settings.general.item')).toBeTruthy()
|
|
})
|
|
})
|