Files
Agent-System/web/src/hooks/useSendMessage.test.ts
T
weichenandCursor 52f69fe180 refactor(web): send chat messages from one hook
Keep attachment registration, task dispatch, and the demo shortcuts on the same path so a failed upload still blocks before any local message is stored.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 11:46:07 +00:00

16 lines
752 B
TypeScript

import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
test('sending a message lives in one hook', () => {
const app = readFileSync(new URL('../App.tsx', import.meta.url), 'utf8');
const hook = readFileSync(new URL('./useSendMessage.ts', import.meta.url), 'utf8');
assert.equal((app.match(/useSendMessage\(/g) || []).length, 1);
assert.equal(app.includes('附件服务端注册失败'), false);
assert.equal(hook.includes('registerUploadAttachments'), true);
assert.equal(hook.includes('runTaskAttempt'), true);
assert.equal(hook.includes('runStreamAttempt'), true);
assert.equal(hook.includes('失败硬拦'), true);
assert.equal(hook.includes('handlePassReview'), true);
});