mirror of
https://github.com/baserow/baserow.git
synced 2026-12-05 00:38:35 +00:00
* feat: add instance AI provider management * fix: simplify AI provider testing * fix: remove extra model list spacing * fix: show AI provider form errors inline * fix: use icons for AI provider row actions * fix: place model errors before help text * chore: polish code * fix: address feedback * fix: address remaining frontend CI failures
57 lines
1.7 KiB
JavaScript
57 lines
1.7 KiB
JavaScript
import { afterEach, beforeEach, describe, expect, test } from 'vitest'
|
|
|
|
import AIProviderModelCombobox from '@baserow/modules/core/components/ai/AIProviderModelCombobox'
|
|
import { TestApp } from '@baserow/test/helpers/testApp'
|
|
|
|
describe('AIProviderModelCombobox', () => {
|
|
let testApp = null
|
|
|
|
beforeEach(() => {
|
|
testApp = new TestApp()
|
|
})
|
|
|
|
afterEach(async () => {
|
|
await testApp.afterEach()
|
|
})
|
|
|
|
test('supports keyboard selection from the known model suggestions', async () => {
|
|
const wrapper = await testApp.mount(AIProviderModelCombobox, {
|
|
props: {
|
|
modelValue: '',
|
|
suggestions: ['gpt-5.6', 'gpt-5.6-terra'],
|
|
},
|
|
})
|
|
const input = wrapper.find('.form-input__input')
|
|
|
|
await input.trigger('focus')
|
|
expect(wrapper.findAll('[role="option"]')).toHaveLength(2)
|
|
|
|
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
await input.trigger('keydown', { key: 'Enter' })
|
|
|
|
expect(wrapper.emitted('update:modelValue')).toContainEqual([
|
|
'gpt-5.6-terra',
|
|
])
|
|
})
|
|
|
|
test('keeps custom identifiers editable when no suggestion matches', async () => {
|
|
const wrapper = await testApp.mount(AIProviderModelCombobox, {
|
|
props: {
|
|
modelValue: '',
|
|
suggestions: ['gpt-5.6'],
|
|
},
|
|
})
|
|
const input = wrapper.find('.form-input__input')
|
|
|
|
await input.trigger('focus')
|
|
await input.setValue('custom-compatible-model')
|
|
|
|
expect(wrapper.emitted('update:modelValue')).toContainEqual([
|
|
'custom-compatible-model',
|
|
])
|
|
await wrapper.setProps({ modelValue: 'custom-compatible-model' })
|
|
expect(wrapper.findAll('[role="option"]')).toHaveLength(0)
|
|
expect(wrapper.text()).toContain('aiProviderAdmin.modelDiscoveryNoMatch')
|
|
})
|
|
})
|