sync: update from private repo (f6d625db)
CI / build-and-test (push) Has been cancelled

This commit is contained in:
oss-sync
2026-06-26 03:35:45 +00:00
parent 29ccaf1e92
commit b857c33ef6
371 changed files with 31312 additions and 8172 deletions
@@ -0,0 +1,57 @@
// @vitest-environment jsdom
import '../../test/dom-setup';
import '../../i18n';
import { describe, expect, it } from 'vitest';
import { screen } from '@testing-library/react';
import { renderWithProviders } from '../../test/render-helpers';
import { DelegateLiveConsole } from './DelegateLiveConsole';
import type { DelegateStreamEntry } from '../../hooks/useJobStream';
function entry(o: Partial<DelegateStreamEntry> = {}): DelegateStreamEntry {
return {
delegateRunId: 'r1', parentRunId: null, depth: 1, description: 'tweet 3 を深掘り',
status: 'running', text: '論点を整理しています', currentTool: null, ...o,
};
}
describe('DelegateLiveConsole', () => {
it('streams が空なら何も描画しない', () => {
const { container } = renderWithProviders(<DelegateLiveConsole streams={{}} />);
expect(container.firstChild).toBeNull();
});
it('実行中の delegate カードを description + ライブ文字つきで描画', () => {
renderWithProviders(<DelegateLiveConsole streams={{ r1: entry() }} />);
expect(screen.getByText('tweet 3 を深掘り')).toBeTruthy();
expect(screen.getByText(/論点を整理しています/)).toBeTruthy();
});
it('currentTool があるとツール実行中を表示', () => {
renderWithProviders(<DelegateLiveConsole streams={{ r1: entry({ text: '', currentTool: 'WebFetch' }) }} />);
expect(screen.getByText(/WebFetch/)).toBeTruthy();
});
it('完了した run は表示しない(履歴は概要に委ねる)— running だけ残す', () => {
const streams = {
done1: entry({ delegateRunId: 'done1', description: '完了したやつ', status: 'success' }),
run1: entry({ delegateRunId: 'run1', description: '走ってるやつ', status: 'running' }),
};
renderWithProviders(<DelegateLiveConsole streams={streams} />);
expect(screen.queryByText('完了したやつ')).toBeNull();
expect(screen.getByText('走ってるやつ')).toBeTruthy();
});
it('全 run が完了済みなら何も描画しない', () => {
const streams = {
done1: entry({ delegateRunId: 'done1', status: 'success' }),
done2: entry({ delegateRunId: 'done2', status: 'aborted' }),
};
const { container } = renderWithProviders(<DelegateLiveConsole streams={streams} />);
expect(container.firstChild).toBeNull();
});
it('入れ子(parentRunId あり)を子としてインデント描画', () => {
const streams = {
r1: entry({ delegateRunId: 'r1', description: '親', depth: 1 }),
r2: entry({ delegateRunId: 'r2', parentRunId: 'r1', description: '子', depth: 2 }),
};
renderWithProviders(<DelegateLiveConsole streams={streams} />);
expect(screen.getByText('親')).toBeTruthy();
expect(screen.getByText('子')).toBeTruthy();
});
});