Files
Jyotisha/frontend/tests/evidence-audit-panel.test.ts
T
Jesse_Chen 551d6317ae
Independent Staging Quality Gate / validate (push) Has been cancelled
Independent Staging Quality Gate / publish (push) Has been cancelled
refactor(chat): extract consultation and session hooks after contract repairs
Keep archive as a PATCH of archived_at rather than DELETE, pass entry_mode through onboarding, and let popstate to the default chat reuse selectSession. Then move send/stop/recovery and session management out of page.tsx so the home surface stays within the batch-two line budget.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-02 04:34:14 +08:00

43 lines
2.3 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
import { homeSurface as pageSource } from "./home-surface.ts";
const rowSource = readFileSync(new URL("../src/components/chat-message-row.tsx", import.meta.url), "utf8");
const contentSource = readFileSync(new URL("../src/components/chat-message-content.tsx", import.meta.url), "utf8");
const panelSource = readFileSync(new URL("../src/components/evidence-audit-panel.tsx", import.meta.url), "utf8");
const globalStyles = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
test("assistant messages fold the user-facing Technique Audit Table and never remount the internal panel", () => {
assert.doesNotMatch(rowSource, /EvidenceAuditPanel/);
assert.doesNotMatch(rowSource, /claimStatus=\{message\.techniqueTruth\}/);
assert.doesNotMatch(rowSource, /workflowReceipt=\{message\.workflowReceipt\}/);
assert.match(contentSource, /TechniqueAuditDisclosure/);
assert.match(rowSource, /auditRows=\{message\.agentExecutionReceipt\?\.techniqueAuditTable\}/);
assert.match(panelSource, /Technique Audit Table/);
assert.match(panelSource, /Workflow route:/);
assert.match(panelSource, /Precise timing:/);
assert.match(panelSource, /Missing route layers/);
assert.match(panelSource, /D1 \/ Natal/);
assert.match(panelSource, /Narayana Dasha/);
assert.match(panelSource, /Functional Benefic\/Malefic/);
assert.match(panelSource, /MEVG \/ Real Case Calibration/);
assert.match(panelSource, /组件 parity 未全闭环/);
assert.match(panelSource, /rawReceipt/);
assert.match(panelSource, /no_birth_data_or_private_case_raw/);
assert.match(panelSource, /查看非敏感 raw receipt/);
assert.match(globalStyles, /\.evidence-audit-panel/);
assert.match(globalStyles, /\.raw-evidence-receipt/);
assert.match(globalStyles, /\.technique-audit >/);
assert.match(globalStyles, /\.markdown-table/);
});
test("consult responses persist workflow receipt headers for evidence rendering", () => {
assert.match(pageSource, /x-jyotish-workflow-route/);
assert.match(pageSource, /x-jyotish-workflow-status/);
assert.match(pageSource, /x-jyotish-precise-timing/);
assert.match(pageSource, /x-jyotish-missing-layers/);
assert.match(pageSource, /workflowReceipt/);
});