Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: tests for components in config (#29739)
Joeld2b63df7a12e
diff --git a/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.spec.tsx b/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.spec.tsxnew file mode 100644index 00000000000..d625e9fb724--- /dev/null+++ b/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.spec.tsx@@ -0,0 +1,22 @@+import React from 'react'+import { fireEvent, render, screen } from '@testing-library/react'+import CannotQueryDataset from './cannot-query-dataset'++describe('CannotQueryDataset WarningMask', () => {+ test('should render dataset warning copy and action button', () => {+ const onConfirm = jest.fn()+ render(<CannotQueryDataset onConfirm={onConfirm} />)++ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.unableToQueryDataSet')).toBeInTheDocument()+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.unableToQueryDataSetTip')).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'appDebug.feature.dataSet.queryVariable.ok' })).toBeInTheDocument()+ })++ test('should invoke onConfirm when OK button clicked', () => {+ const onConfirm = jest.fn()+ render(<CannotQueryDataset onConfirm={onConfirm} />)++ fireEvent.click(screen.getByRole('button', { name: 'appDebug.feature.dataSet.queryVariable.ok' }))+ expect(onConfirm).toHaveBeenCalledTimes(1)+ })+})diff --git a/web/app/components/app/configuration/base/warning-mask/formatting-changed.spec.tsx b/web/app/components/app/configuration/base/warning-mask/formatting-changed.spec.tsxnew file mode 100644index 00000000000..a968bde2720--- /dev/null+++ b/web/app/components/app/configuration/base/warning-mask/formatting-changed.spec.tsx@@ -0,0 +1,39 @@+import React from 'react'+import { fireEvent, render, screen } from '@testing-library/react'+import FormattingChanged from './formatting-changed'++describe('FormattingChanged WarningMask', () => {+ test('should display translation text and both actions', () => {+ const onConfirm = jest.fn()+ const onCancel = jest.fn()++ render(+ <FormattingChanged+ onConfirm={onConfirm}+ onCancel={onCancel}+ />,+ )++ expect(screen.getByText('appDebug.formattingChangedTitle')).toBeInTheDocument()+ expect(screen.getByText('appDebug.formattingChangedText')).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'common.operation.cancel' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /common\.operation\.refresh/ })).toBeInTheDocument()+ })++ test('should call callbacks when buttons are clicked', () => {+ const onConfirm = jest.fn()+ const onCancel = jest.fn()+ render(+ <FormattingChanged+ onConfirm={onConfirm}+ onCancel={onCancel}+ />,+ )++ fireEvent.click(screen.getByRole('button', { name: /common\.operation\.refresh/ }))+ fireEvent.click(screen.getByRole('button', { name: 'common.operation.cancel' }))++ expect(onConfirm).toHaveBeenCalledTimes(1)+ expect(onCancel).toHaveBeenCalledTimes(1)+ })+})diff --git a/web/app/components/app/configuration/base/warning-mask/has-not-set-api.spec.tsx b/web/app/components/app/configuration/base/warning-mask/has-not-set-api.spec.tsxnew file mode 100644index 00000000000..46608374da4--- /dev/null+++ b/web/app/components/app/configuration/base/warning-mask/has-not-set-api.spec.tsx@@ -0,0 +1,26 @@+import React from 'react'+import { fireEvent, render, screen } from '@testing-library/react'+import HasNotSetAPI from './has-not-set-api'++describe('HasNotSetAPI WarningMask', () => {+ test('should show default title when trial not finished', () => {+ render(<HasNotSetAPI isTrailFinished={false} onSetting={jest.fn()} />)++ expect(screen.getByText('appDebug.notSetAPIKey.title')).toBeInTheDocument()+ expect(screen.getByText('appDebug.notSetAPIKey.description')).toBeInTheDocument()+ })++ test('should show trail finished title when flag is true', () => {+ render(<HasNotSetAPI isTrailFinished onSetting={jest.fn()} />)++ expect(screen.getByText('appDebug.notSetAPIKey.trailFinished')).toBeInTheDocument()+ })++ test('should call onSetting when primary button clicked', () => {+ const onSetting = jest.fn()+ render(<HasNotSetAPI isTrailFinished={false} onSetting={onSetting} />)++ fireEvent.click(screen.getByRole('button', { name: 'appDebug.notSetAPIKey.settingBtn' }))+ expect(onSetting).toHaveBeenCalledTimes(1)+ })+})diff --git a/web/app/components/app/configuration/base/warning-mask/index.spec.tsx b/web/app/components/app/configuration/base/warning-mask/index.spec.tsxnew file mode 100644index 00000000000..6d533a423d9--- /dev/null+++ b/web/app/components/app/configuration/base/warning-mask/index.spec.tsx@@ -0,0 +1,25 @@+import React from 'react'+import { render, screen } from '@testing-library/react'+import WarningMask from './index'++describe('WarningMask', () => {+ // Rendering of title, description, and footer content+ describe('Rendering', () => {+ test('should display provided title, description, and footer node', () => {+ const footer = <button type="button">Retry</button>+ // Arrange+ render(+ <WarningMask+ title="Access Restricted"+ description="Only workspace owners may modify this section."+ footer={footer}+ />,+ )++ // Assert+ expect(screen.getByText('Access Restricted')).toBeInTheDocument()+ expect(screen.getByText('Only workspace owners may modify this section.')).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'Retry' })).toBeInTheDocument()+ })+ })+})diff --git a/web/app/components/app/configuration/config-var/select-type-item/index.spec.tsx b/web/app/components/app/configuration/config-var/select-type-item/index.spec.tsxnew file mode 100644index 00000000000..469164e6077--- /dev/null+++ b/web/app/components/app/configuration/config-var/select-type-item/index.spec.tsx@@ -0,0 +1,45 @@+import React from 'react'+import { fireEvent, render, screen } from '@testing-library/react'+import SelectTypeItem from './index'+import { InputVarType } from '@/app/components/workflow/types'++describe('SelectTypeItem', () => {+ // Rendering pathways based on type and selection state+ describe('Rendering', () => {+ test('should render ok', () => {+ // Arrange+ const { container } = render(+ <SelectTypeItem+ type={InputVarType.textInput}+ selected={false}+ onClick={jest.fn()}+ />,+ )++ // Assert+ expect(screen.getByText('appDebug.variableConfig.text-input')).toBeInTheDocument()+ expect(container.querySelector('svg')).not.toBeNull()+ })+ })++ // User interaction outcomes+ describe('Interactions', () => {+ test('should trigger onClick when item is pressed', () => {+ const handleClick = jest.fn()+ // Arrange+ render(+ <SelectTypeItem+ type={InputVarType.paragraph}+ selected={false}+ onClick={handleClick}+ />,+ )++ // Act+ fireEvent.click(screen.getByText('appDebug.variableConfig.paragraph'))++ // Assert+ expect(handleClick).toHaveBeenCalledTimes(1)+ })+ })+})