wip: first run of implementation
This commit is contained in:
30
tests/renderer/navigation/protocolNeedsInput.test.ts
Normal file
30
tests/renderer/navigation/protocolNeedsInput.test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { toClarificationElements } from '../../../src/renderer/navigation/protocolNeedsInput';
|
||||
|
||||
describe('protocolNeedsInput', () => {
|
||||
it('builds a clarification form element when required fields are provided', () => {
|
||||
const elements = toClarificationElements({
|
||||
required: true,
|
||||
fields: [
|
||||
{ key: 'date', label: 'Date', inputType: 'date', required: true },
|
||||
{ key: 'category', label: 'Category', inputType: 'select', options: [{ label: 'A', value: 'a' }] },
|
||||
],
|
||||
});
|
||||
|
||||
expect(elements).toHaveLength(1);
|
||||
expect(elements[0]).toMatchObject({
|
||||
type: 'form',
|
||||
formId: 'agui-needs-input',
|
||||
action: 'submitNeedsInput',
|
||||
});
|
||||
});
|
||||
|
||||
it('returns empty elements when input is not required', () => {
|
||||
const elements = toClarificationElements({
|
||||
required: false,
|
||||
fields: [],
|
||||
});
|
||||
|
||||
expect(elements).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user