Files
openchamber/packages/ui/src/components/chat/message/parts/JsonSummaryView.test.tsx
T
Bohdan Triapitsyn b3fa19fe3e feat: add navigable JSON summaries for tool output
Tool JSON output now starts with a compact navigable summary view.
Expandable tool output includes quick open-file and diff actions for changed files.
Reasoning headers strip stray HTML comments, and navigation tools stay compact.
2026-07-10 14:51:33 +03:00

35 lines
1.2 KiB
TypeScript

import React from 'react';
import { describe, expect, test } from 'bun:test';
import { renderToStaticMarkup } from 'react-dom/server';
import { JsonSummaryView } from './JsonSummaryView';
describe('JsonSummaryView', () => {
test('prioritizes a record identity and makes URLs navigable', () => {
const html = renderToStaticMarkup(
<JsonSummaryView
data={{
id: 'OPE-266',
title: 'Refresh git status',
url: 'https://linear.app/openchamber/issue/OPE-266',
relations: { blocks: [] },
}}
/>,
);
expect(html).toContain('OPE-266 · Refresh git status');
expect(html).toContain('href="https://linear.app/openchamber/issue/OPE-266"');
expect(html).toContain('Relations');
expect(html).not.toContain('surface-elevated');
});
test('summarizes record arrays as expandable sections', () => {
const html = renderToStaticMarkup(
<JsonSummaryView data={{ issues: [{ identifier: 'OPE-1', name: 'Example issue' }] }} />,
);
expect(html).toContain('Issues (1)');
expect(html).toContain('OPE-1 · Example issue');
});
});