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
import { render, screen, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { useState } from 'react'
import { IndexingType } from '../../../create/step-two'
import IndexMethod from '../index'
const Settings = ({
disabled = false,
currentValue = IndexingType.ECONOMICAL,
}: {
disabled?: boolean
currentValue?: IndexingType
}) => {
const [value, setValue] = useState<IndexingType>(currentValue)
const [keywordNumber, setKeywordNumber] = useState(10)
return (
<IndexMethod
value={value}
onChange={setValue}
currentValue={currentValue}
disabled={disabled}
keywordNumber={keywordNumber}
onKeywordNumberChange={setKeywordNumber}
/>
)
}
describe('IndexMethod', () => {
it('hides inactive economy parameters and preserves their draft when switching back', async () => {
const user = userEvent.setup()
render(<Settings />)
const group = screen.getByRole('radiogroup', { name: 'datasetSettings.form.indexMethod' })
const economy = within(group).getByRole('radio', {
name: 'datasetSettings.form.indexMethodEconomy',
})
const qualified = within(group).getByRole('radio', {
name: 'datasetCreation.stepTwo.qualified',
})
const input = screen.getByRole('textbox', { name: 'datasetSettings.form.numberOfKeywords' })
expect(economy).toBeChecked()
expect(economy).not.toContainElement(input)
await user.clear(input)
await user.type(input, '25')
await user.tab()
await user.click(qualified)
expect(qualified).toBeChecked()
expect(economy).not.toBeChecked()
expect(
screen.queryByRole('textbox', { name: 'datasetSettings.form.numberOfKeywords' }),
).not.toBeInTheDocument()
await user.click(economy)
expect(
screen.getByRole('textbox', { name: 'datasetSettings.form.numberOfKeywords' }),
).toHaveValue('25')
})
it('keeps Economy selected while editing keyword parameters with arrow keys', async () => {
const user = userEvent.setup()
render(<Settings />)
const input = screen.getByRole('textbox', { name: 'datasetSettings.form.numberOfKeywords' })
await user.click(input)
await user.keyboard('{ArrowRight}{ArrowLeft}{ArrowUp}{ArrowDown}')
expect(
screen.getByRole('radio', { name: 'datasetSettings.form.indexMethodEconomy' }),
).toBeChecked()
expect(input).toHaveFocus()
})
it('prevents editing keywords or selection while settings are disabled', async () => {
const user = userEvent.setup()
render(<Settings disabled />)
const input = screen.getByRole('textbox', { name: 'datasetSettings.form.numberOfKeywords' })
expect(input).toBeDisabled()
const qualified = screen.getByRole('radio', { name: 'datasetCreation.stepTwo.qualified' })
await user.click(qualified)
expect(qualified).not.toBeChecked()
})
it('does not allow an existing high quality dataset to downgrade to economy', async () => {
const user = userEvent.setup()
render(<Settings currentValue={IndexingType.QUALIFIED} />)
const economy = screen.getByRole('radio', { name: 'datasetSettings.form.indexMethodEconomy' })
await user.click(economy)
expect(economy).not.toBeChecked()
expect(screen.queryByRole('textbox')).not.toBeInTheDocument()
expect(economy).toHaveAccessibleDescription(
/datasetSettings.form.indexMethodChangeToEconomyDisabledTip/,
)
})
})