fix(web): remove tool-call settings placeholder

This commit is contained in:
Yichen Jiang
2026-07-31 12:48:39 +08:00
parent ee74b5b07a
commit f45b6f76a5
15 changed files with 30 additions and 169 deletions

View File

@@ -1,18 +1,17 @@
// @vitest-environment jsdom
import { afterEach, describe, expect, it, vi } from 'vitest'
import { cleanup, render, screen } from '@testing-library/react'
import type {
GeneralSectionComponentProps, ToolCallSkeletonProps,
} from '../src/client/GeneralSection.tsx'
import { GeneralSection, ToolCallSkeleton } from '../src/client/GeneralSection.tsx'
import type { GeneralSectionComponentProps } from '../src/client/GeneralSection.tsx'
import { GeneralSection } from '../src/client/GeneralSection.tsx'
import { CloseLabel, HeaderContent, TriggerContent } from '../src/client/chrome.tsx'
import type { TriggerContentProps } from '../src/client/chrome.tsx'
import { en } from '../src/client/locales.ts'
afterEach(cleanup)
// The seat's key domain is settings ∪ common; the stub answers from the
// package dictionary and falls back to the key like the real chain.
const t: ToolCallSkeletonProps['t'] = key => (en as Record<string, string>)[key] ?? key
const t: TriggerContentProps['t'] = key => (en as Record<string, string>)[key] ?? key
// Global standard kit stubs: none of these components consume the hooks.
const unusedHook = (() => { throw new Error('unused by settings-general components') }) as never
@@ -55,16 +54,3 @@ describe('GeneralSection', () => {
expect(screen.getByTestId('slot-settings.general.item')).toBeTruthy()
})
})
describe('ToolCallSkeleton', () => {
it('renders the mode cubes with schema pinned selected', () => {
render(<ToolCallSkeleton {...kit} t={t} />)
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()
})
})