fix: avoid stray zero in consultation composer

This commit is contained in:
2026-09-24 13:51:34 +08:00
parent 0a8fce67a4
commit 3c68155ecd
4 changed files with 57 additions and 1 deletions

View File

@@ -96,6 +96,15 @@ async function ready() {
await waitFor(() => expect(streams.has('first')).toBe(true));
}
describe('teacher side chat', () => {
it('does not render a zero for an empty legacy friend draft', async () => {
localStorage.setItem('makelore-consultation-draft:signed-out:p:friend', JSON.stringify({ text: '', references: [] }));
render(<TeacherChatPanel projectId="p" sourceId="c" />);
await ready();
const composer = screen.getByLabelText('向智能体提问').closest('form');
expect(composer).not.toHaveTextContent(/^0/);
expect(screen.queryByText('查看旧版朋友草稿')).not.toBeInTheDocument();
});
it('retains failed input and retries with the same request id, then appends a reply only on click', async () => {
const bringBack = vi.fn();
api.send