2025-12-31 15:00:35 -05:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { describe, it, expect } from 'vitest';
|
2025-12-31 15:09:51 -05:00
|
|
|
import { render } from '../../../test-utils/render.js';
|
2025-12-31 15:00:35 -05:00
|
|
|
import { ThinkingMessage } from './ThinkingMessage.js';
|
|
|
|
|
|
|
|
|
|
describe('ThinkingMessage', () => {
|
2026-01-31 11:35:59 -05:00
|
|
|
it('renders thinking subject', () => {
|
2025-12-31 15:00:35 -05:00
|
|
|
const { lastFrame } = render(
|
|
|
|
|
<ThinkingMessage
|
2026-01-31 11:22:47 -05:00
|
|
|
thought={{ subject: 'Planning', description: 'test' }}
|
2025-12-31 15:00:35 -05:00
|
|
|
terminalWidth={80}
|
|
|
|
|
/>,
|
|
|
|
|
);
|
|
|
|
|
|
2026-01-31 11:35:59 -05:00
|
|
|
expect(lastFrame()).toContain('Planning');
|
2025-12-31 15:00:35 -05:00
|
|
|
});
|
|
|
|
|
|
2026-01-31 11:22:47 -05:00
|
|
|
it('renders with thought subject', () => {
|
2025-12-31 15:00:35 -05:00
|
|
|
const { lastFrame } = render(
|
|
|
|
|
<ThinkingMessage
|
2026-01-31 11:22:47 -05:00
|
|
|
thought={{ subject: 'Processing', description: 'test' }}
|
2025-12-31 15:00:35 -05:00
|
|
|
terminalWidth={80}
|
|
|
|
|
/>,
|
|
|
|
|
);
|
|
|
|
|
|
2026-01-31 11:22:47 -05:00
|
|
|
expect(lastFrame()).toContain('Processing');
|
2025-12-31 15:00:35 -05:00
|
|
|
});
|
|
|
|
|
|
2026-01-03 19:00:15 -05:00
|
|
|
it('renders thought content', () => {
|
|
|
|
|
const { lastFrame } = render(
|
|
|
|
|
<ThinkingMessage
|
2026-01-31 11:22:47 -05:00
|
|
|
thought={{
|
|
|
|
|
subject: 'Planning',
|
|
|
|
|
description: 'I am planning the solution.',
|
|
|
|
|
}}
|
2026-01-03 19:00:15 -05:00
|
|
|
terminalWidth={80}
|
|
|
|
|
/>,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
expect(lastFrame()).toContain('Planning');
|
|
|
|
|
expect(lastFrame()).toContain('I am planning the solution.');
|
|
|
|
|
});
|
|
|
|
|
|
2025-12-31 15:00:35 -05:00
|
|
|
it('renders empty state gracefully', () => {
|
|
|
|
|
const { lastFrame } = render(
|
2026-01-31 11:22:47 -05:00
|
|
|
<ThinkingMessage
|
|
|
|
|
thought={{ subject: '', description: '' }}
|
|
|
|
|
terminalWidth={80}
|
|
|
|
|
/>,
|
2025-12-31 15:00:35 -05:00
|
|
|
);
|
|
|
|
|
|
2026-01-31 11:35:59 -05:00
|
|
|
expect(lastFrame()).not.toContain('Planning');
|
2025-12-31 15:00:35 -05:00
|
|
|
});
|
|
|
|
|
});
|