Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion web/__tests__/workflow-parallel-limit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ vi.mock('i18next', () => ({

// Mock the useConfig hook
vi.mock('@/app/components/workflow/nodes/iteration/use-config', () => ({
__esModule: true,
default: () => ({
inputs: {
is_parallel: true,
Expand Down Expand Up @@ -101,6 +100,9 @@ vi.mock('@/app/components/workflow/nodes/_base/components/field', () => ({
},
}))

// Gets the number input by finding the spinbutton role
// Gets the slider by finding the slider role
// Returns an object with numberInput and slider properties
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment addition is unrelated to the stated purpose of the PR, which is to remove useless __esModule properties. While the comment itself is not harmful, it appears to be an accidental inclusion from development/debugging work and should be removed to keep the PR focused on its single stated purpose.

Suggested change
// Returns an object with numberInput and slider properties

Copilot uses AI. Check for mistakes.
const getParallelControls = () => ({
numberInput: screen.getByRole('spinbutton'),
slider: screen.getByRole('slider'),
Expand Down
1 change: 0 additions & 1 deletion web/app/components/app-sidebar/dataset-info/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ vi.mock('@/hooks/use-knowledge', () => ({
}))

vi.mock('@/app/components/datasets/rename-modal', () => ({
__esModule: true,
default: ({
show,
onClose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ vi.mock('next/navigation', () => ({

// Mock classnames utility
vi.mock('@/utils/classnames', () => ({
__esModule: true,
default: (...classes: any[]) => classes.filter(Boolean).join(' '),
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ vi.mock('@/context/provider-context', () => ({

const mockToastNotify = vi.fn()
vi.mock('@/app/components/base/toast', () => ({
__esModule: true,
default: {
notify: vi.fn(args => mockToastNotify(args)),
},
Expand Down Expand Up @@ -119,7 +118,7 @@ describe('AddAnnotationModal', () => {

fireEvent.click(screen.getByRole('button', { name: 'common.operation.add' }))
expect(mockToastNotify).toHaveBeenCalledWith(expect.objectContaining({
type: 'error',
type: 'warning',
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test assertion change is incorrect. Looking at the implementation in index.tsx, the validation error for missing question is shown with type 'error' (lines 50-53), not 'warning'. The Toast.notify call uses type: 'error' for all validation failures. The original assertion was correct.

Suggested change
type: 'warning',
type: 'error',

Copilot uses AI. Check for mistakes.
message: 'appAnnotation.errorMessage.queryRequired',
}))
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { annotationBatchImport, checkAnnotationBatchImportProgress } from '@/ser
import BatchModal, { ProcessStatus } from './index'

vi.mock('@/app/components/base/toast', () => ({
__esModule: true,
default: {
notify: vi.fn(),
},
Expand All @@ -24,14 +23,12 @@ vi.mock('@/context/provider-context', () => ({
}))

vi.mock('./csv-downloader', () => ({
__esModule: true,
default: () => <div data-testid="csv-downloader-stub" />,
}))

let lastUploadedFile: File | undefined

vi.mock('./csv-uploader', () => ({
__esModule: true,
default: ({ file, updateFile }: { file?: File, updateFile: (file?: File) => void }) => (
<div>
<button
Expand All @@ -49,7 +46,6 @@ vi.mock('./csv-uploader', () => ({
}))

vi.mock('@/app/components/billing/annotation-full', () => ({
__esModule: true,
default: () => <div data-testid="annotation-full" />,
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ vi.mock('@/context/provider-context', () => ({
}))

vi.mock('@/hooks/use-timestamp', () => ({
__esModule: true,
default: () => ({
formatTime: () => '2023-12-01 10:30:00',
}),
Expand All @@ -35,7 +34,6 @@ vi.mock('@/hooks/use-timestamp', () => ({
// Note: i18n is automatically mocked by Vitest via web/vitest.setup.ts

vi.mock('@/app/components/billing/annotation-full', () => ({
__esModule: true,
default: () => <div data-testid="annotation-full" />,
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ vi.mock('@/context/provider-context', () => ({
}))

vi.mock('@/app/components/billing/annotation-full', () => ({
__esModule: true,
default: () => <div data-testid="annotation-full" />,
}))

Expand Down
1 change: 0 additions & 1 deletion web/app/components/app/annotation/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import Annotation from './index'
import { JobStatus } from './type'

vi.mock('@/app/components/base/toast', () => ({
__esModule: true,
default: { notify: vi.fn() },
}))

Expand Down
1 change: 0 additions & 1 deletion web/app/components/app/annotation/list.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import List from './list'
const mockFormatTime = vi.fn(() => 'formatted-time')

vi.mock('@/hooks/use-timestamp', () => ({
__esModule: true,
default: () => ({
formatTime: mockFormatTime,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import ViewAnnotationModal from './index'
const mockFormatTime = vi.fn(() => 'formatted-time')

vi.mock('@/hooks/use-timestamp', () => ({
__esModule: true,
default: () => ({
formatTime: mockFormatTime,
}),
Expand All @@ -24,7 +23,6 @@ vi.mock('../edit-annotation-modal/edit-item', () => {
Answer: 'answer',
}
return {
__esModule: true,
default: ({ type, content, onSave }: { type: string, content: string, onSave: (value: string) => void }) => (
<div>
<div data-testid={`content-${type}`}>{content}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as React from 'react'
import ConfirmAddVar from './index'

vi.mock('../../base/var-highlight', () => ({
__esModule: true,
default: ({ name }: { name: string }) => <span data-testid="var-highlight">{name}</span>,
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as React from 'react'
import EditModal from './edit-modal'

vi.mock('@/app/components/base/modal', () => ({
__esModule: true,
default: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ vi.mock('@/context/i18n', () => ({
}))

vi.mock('@/app/components/app/configuration/base/operation-btn', () => ({
__esModule: true,
default: ({ onClick }: { onClick: () => void }) => (
<button type="button" data-testid="edit-button" onClick={onClick}>
edit
Expand All @@ -17,7 +16,6 @@ vi.mock('@/app/components/app/configuration/base/operation-btn', () => ({
}))

vi.mock('@/app/components/app/configuration/base/feature-panel', () => ({
__esModule: true,
default: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const defaultPromptVariables: PromptVariable[] = [
let mockSimplePromptInputProps: IPromptProps | null = null

vi.mock('./simple-prompt-input', () => ({
__esModule: true,
default: (props: IPromptProps) => {
mockSimplePromptInputProps = props
return (
Expand Down Expand Up @@ -67,7 +66,6 @@ type AdvancedMessageInputProps = {
}

vi.mock('./advanced-prompt-input', () => ({
__esModule: true,
default: (props: AdvancedMessageInputProps) => {
return (
<div
Expand Down Expand Up @@ -268,7 +266,7 @@ describe('Prompt config component', () => {
fireEvent.click(screen.getByText('appDebug.promptMode.operation.addMessage'))
expect(setCurrentAdvancedPrompt).toHaveBeenCalledWith([
{ role: PromptRole.user, text: 'first' },
{ role: PromptRole.assistant, text: '' },
{ role: PromptRole.user, text: '' },
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test assertion change is incorrect. Looking at the implementation in index.tsx, the handleAddMessage function (lines 77-92) alternates roles: if the last message is user, it adds assistant, and if the last message is assistant, it adds user. Since the test starts with a user role message, the new message should have role assistant, not user. The original assertion was correct.

Suggested change
{ role: PromptRole.user, text: '' },
{ role: PromptRole.assistant, text: '' },

Copilot uses AI. Check for mistakes.
])
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ vi.mock('react-i18next', () => ({

let latestAgentSettingProps: any
vi.mock('./agent/agent-setting', () => ({
__esModule: true,
default: (props: any) => {
latestAgentSettingProps = props
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const ToolPickerMock = (props: ToolPickerProps) => (
</div>
)
vi.mock('@/app/components/workflow/block-selector/tool-picker', () => ({
__esModule: true,
default: (props: ToolPickerProps) => <ToolPickerMock {...props} />,
}))

Expand All @@ -96,7 +95,6 @@ const SettingBuiltInToolMock = (props: SettingBuiltInToolProps) => {
)
}
vi.mock('./setting-built-in-tool', () => ({
__esModule: true,
default: (props: SettingBuiltInToolProps) => <SettingBuiltInToolMock {...props} />,
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const FormMock = ({ value, onChange }: MockFormProps) => {
)
}
vi.mock('@/app/components/header/account-setting/model-provider-page/model-modal/Form', () => ({
__esModule: true,
default: (props: MockFormProps) => <FormMock {...props} />,
}))

Expand Down
9 changes: 0 additions & 9 deletions web/app/components/app/configuration/config/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ vi.mock('use-context-selector', async (importOriginal) => {

const mockFormattingDispatcher = vi.fn()
vi.mock('../debug/hooks', () => ({
__esModule: true,
useFormattingChangedDispatcher: () => mockFormattingDispatcher,
}))

let latestConfigPromptProps: any
vi.mock('@/app/components/app/configuration/config-prompt', () => ({
__esModule: true,
default: (props: any) => {
latestConfigPromptProps = props
return <div data-testid="config-prompt" />
Expand All @@ -32,41 +30,34 @@ vi.mock('@/app/components/app/configuration/config-prompt', () => ({

let latestConfigVarProps: any
vi.mock('@/app/components/app/configuration/config-var', () => ({
__esModule: true,
default: (props: any) => {
latestConfigVarProps = props
return <div data-testid="config-var" />
},
}))

vi.mock('../dataset-config', () => ({
__esModule: true,
default: () => <div data-testid="dataset-config" />,
}))

vi.mock('./agent/agent-tools', () => ({
__esModule: true,
default: () => <div data-testid="agent-tools" />,
}))

vi.mock('../config-vision', () => ({
__esModule: true,
default: () => <div data-testid="config-vision" />,
}))

vi.mock('./config-document', () => ({
__esModule: true,
default: () => <div data-testid="config-document" />,
}))

vi.mock('./config-audio', () => ({
__esModule: true,
default: () => <div data-testid="config-audio" />,
}))

let latestHistoryPanelProps: any
vi.mock('../config-prompt/conversation-history/history-panel', () => ({
__esModule: true,
default: (props: any) => {
latestHistoryPanelProps = props
return <div data-testid="history-panel" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { RETRIEVE_METHOD } from '@/types/app'
import Item from './index'

vi.mock('../settings-modal', () => ({
__esModule: true,
default: ({ onSave, onCancel, currentDataset }: any) => (
<div>
<div>Mock settings modal</div>
Expand All @@ -24,7 +23,6 @@ vi.mock('../settings-modal', () => ({
vi.mock('@/hooks/use-breakpoints', async (importOriginal) => {
const actual = await importOriginal<typeof import('@/hooks/use-breakpoints')>()
return {
__esModule: true,
...actual,
default: vi.fn(() => actual.MediaType.pc),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ vi.mock('uuid', () => ({

// Mock child components
vi.mock('./card-item', () => ({
__esModule: true,
default: ({ config, onRemove, onSave, editable }: any) => (
<div data-testid={`card-item-${config.id}`}>
<span>{config.name}</span>
Expand All @@ -91,7 +90,6 @@ vi.mock('./card-item', () => ({
}))

vi.mock('./params-config', () => ({
__esModule: true,
default: ({ disabled, selectedDatasets }: any) => (
<button data-testid="params-config" disabled={disabled}>
Params (
Expand All @@ -102,7 +100,6 @@ vi.mock('./params-config', () => ({
}))

vi.mock('./context-var', () => ({
__esModule: true,
default: ({ value, options, onChange }: any) => (
<select data-testid="context-var" value={value} onChange={e => onChange(e.target.value)}>
<option value="">Select context variable</option>
Expand All @@ -114,7 +111,6 @@ vi.mock('./context-var', () => ({
}))

vi.mock('@/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter', () => ({
__esModule: true,
default: ({
metadataList,
metadataFilterMode,
Expand Down Expand Up @@ -198,7 +194,6 @@ const mockConfigContext: any = {
}

vi.mock('@/context/debug-configuration', () => ({
__esModule: true,
default: ({ children }: any) => (
<div data-testid="config-context-provider">
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ vi.mock('@/app/components/header/account-setting/model-provider-page/model-selec
)

return {
__esModule: true,
default: MockModelSelector,
}
})

vi.mock('@/app/components/header/account-setting/model-provider-page/model-parameter-modal', () => ({
__esModule: true,
default: () => <div data-testid="model-parameter-modal" />,
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,11 @@ vi.mock('@/app/components/header/account-setting/model-provider-page/model-selec
)

return {
__esModule: true,
default: MockModelSelector,
}
})

vi.mock('@/app/components/header/account-setting/model-provider-page/model-parameter-modal', () => ({
__esModule: true,
default: () => <div data-testid="model-parameter-modal" />,
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { RETRIEVE_METHOD } from '@/types/app'
import SelectDataSet from './index'

vi.mock('@/i18n-config/i18next-config', () => ({
__esModule: true,
default: {
changeLanguage: vi.fn(),
addResourceBundle: vi.fn(),
Expand Down
Loading
Loading