Files
Jyotisha/frontend/tests/consultation-smalltalk-ui.test.tsx
T
jesse-uxandClaude Code 539d4daee4
Independent Staging Quality Gate / validate (push) Successful in 9m35s
Independent Staging Quality Gate / publish (push) Successful in 3m52s
feat(consult): add free model-classified smalltalk fast path
Keep full consultation tool contracts unchanged. Persist short replies and refund the original reservation atomically while recording actual model usage. Verify Linux frontend 3566/3566, database 40/40, Static home and gzip +0.0493%.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-20 12:58:34 +08:00

22 lines
1.4 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import React from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { ChatMessageRow } from "../src/components/chat-message-row.tsx";
import { settledChatMessageViews, streamingChatMessageView } from "../src/lib/chat-message-view.ts";
test("settled and streaming smalltalk render text without thinking, activity or evidence", () => {
const settled = settledChatMessageViews([{ role: "assistant", text: "你好", responseKind: "smalltalk", thinkingText: "must stay hidden" }])[0]!;
const streaming = streamingChatMessageView([{ role: "user", text: "你好" }], true, "你好", undefined, undefined, undefined, [], "smalltalk")!;
for (const message of [settled, streaming]) {
const html = renderToStaticMarkup(<ChatMessageRow message={message} />);
assert.match(html, /你好/);
assert.doesNotMatch(html, /consultation-thinking-report|agent-activity|must stay hidden|已完成|技法|正在分析/);
}
});
test("classification wait does not invent a thinking step before any activity", () => {
const message = streamingChatMessageView([{ role: "user", text: "你好" }], true, "", undefined, undefined, undefined, [])!;
const html = renderToStaticMarkup(<ChatMessageRow message={message} />);
assert.doesNotMatch(html, /consultation-thinking-report|正在处理|正在分析|已完成/);
});