2026-06-08 11:50:56 -04:00
|
|
|
import { describe, expect, test } from 'bun:test';
|
|
|
|
|
|
|
|
|
|
import { readTaskTagSessionIdFromOutput } from './taskSessionIdParser';
|
2026-07-24 21:54:28 +03:00
|
|
|
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');
|
|
|
|
|
});
|
|
|
|
|
});
|
2026-07-24 21:54:28 +03:00
|
|
|
|
|
|
|
|
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 });
|
|
|
|
|
});
|
|
|
|
|
});
|