43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
buildTaskAgentOptions,
|
|
taskAgentLabel,
|
|
} from '../src/utils/taskAgentOptions'
|
|
|
|
describe('live task assignee options', () => {
|
|
it('combines only local assignment concepts with the live OpenClaw inventory', () => {
|
|
const options = buildTaskAgentOptions([
|
|
{ id: 'iris', name: 'Iris' },
|
|
{ id: 'new-specialist', name: 'New Specialist' },
|
|
])
|
|
|
|
expect(options).toEqual([
|
|
{ id: '', label: 'Nicht zugewiesen' },
|
|
{ id: 'bao', label: 'Bao' },
|
|
{ id: 'iris', label: 'Iris' },
|
|
{ id: 'new-specialist', label: 'New Specialist' },
|
|
])
|
|
expect(options.some(option => option.id === 'programmer')).toBe(false)
|
|
})
|
|
|
|
it('preserves a persisted unknown assignee while OpenClaw is disconnected', () => {
|
|
const options = buildTaskAgentOptions([], ['retired-agent'])
|
|
|
|
expect(options).toContainEqual({
|
|
id: 'retired-agent',
|
|
label: 'retired-agent',
|
|
})
|
|
expect(taskAgentLabel('retired-agent', options)).toBe('retired-agent')
|
|
})
|
|
|
|
it('prefers the live display name for an already persisted agent id', () => {
|
|
const options = buildTaskAgentOptions(
|
|
[{ id: 'product-owner', name: 'Product Owner' }],
|
|
['product-owner'],
|
|
)
|
|
|
|
expect(taskAgentLabel('product-owner', options)).toBe('Product Owner')
|
|
expect(options.filter(option => option.id === 'product-owner')).toHaveLength(1)
|
|
})
|
|
})
|