Files
openchamber/packages/ui/src/components/chat/message/parts/ToolPart.test.ts
T

27 lines
985 B
TypeScript
Raw Normal View History

2026-06-08 11:50:56 -04:00
import { describe, expect, test } from 'bun:test';
import { readTaskTagSessionIdFromOutput } from './taskSessionIdParser';
import { tryParseJsonOutput } from '../toolRenderers';
2026-06-08 11:50:56 -04:00
describe('readTaskTagSessionIdFromOutput', () => {
test('parses task tags without state attributes', () => {
expect(readTaskTagSessionIdFromOutput('<task id="ses_abc123">')).toBe('ses_abc123');
});
test('parses task tags with additional attributes', () => {
expect(readTaskTagSessionIdFromOutput('<task id="ses_def456" state="completed">')).toBe('ses_def456');
});
});
describe('OpenChamber tool output', () => {
test('keeps the result envelope in the generic JSON rendering pipeline', () => {
const result = {
schemaVersion: 1,
ok: true,
action: 'projects.list',
data: { projects: [] },
};
expect(tryParseJsonOutput(JSON.stringify(result))).toEqual({ data: result, isJson: true });
});
});