diff --git a/web/app/components/app/configuration/debug/chat-user-input.spec.tsx b/web/app/components/app/configuration/debug/chat-user-input.spec.tsx new file mode 100644 index 0000000000..e6678ebf29 --- /dev/null +++ b/web/app/components/app/configuration/debug/chat-user-input.spec.tsx @@ -0,0 +1,710 @@ +import type { Inputs, ModelConfig } from '@/models/debug' +import type { PromptVariable } from '@/types/app' +import { fireEvent, render, screen } from '@testing-library/react' +import ChatUserInput from './chat-user-input' + +const mockSetInputs = vi.fn() +const mockUseContext = vi.fn() + +vi.mock('react-i18next', () => ({ + useTranslation: () => ({ + t: (key: string) => key, + }), +})) + +vi.mock('use-context-selector', () => ({ + useContext: () => mockUseContext(), + createContext: vi.fn(() => ({})), +})) + +vi.mock('@/app/components/base/input', () => ({ + default: ({ value, onChange, placeholder, autoFocus, maxLength, readOnly, type }: { + value: string + onChange: (e: { target: { value: string } }) => void + placeholder?: string + autoFocus?: boolean + maxLength?: number + readOnly?: boolean + type?: string + }) => ( + + ), +})) + +vi.mock('@/app/components/base/select', () => ({ + default: ({ defaultValue, onSelect, items, disabled, className }: { + defaultValue: string + onSelect: (item: { value: string }) => void + items: { name: string, value: string }[] + allowSearch?: boolean + disabled?: boolean + className?: string + }) => ( + + ), +})) + +vi.mock('@/app/components/base/textarea', () => ({ + default: ({ value, onChange, placeholder, readOnly, className }: { + value: string + onChange: (e: { target: { value: string } }) => void + placeholder?: string + readOnly?: boolean + className?: string + }) => ( +