Files
memind/health-intent-rules.test.mjs
T
john f96fdcb3b9 feat(health): add P0 health channel kernel and encrypted health zone.
Lock health recording behind confirm-only state machines, reject public publishes for the health category, and ship the 14-day experiment Page Data templates with tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 18:04:26 +08:00

27 lines
1017 B
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import {
matchHealthIdleRules,
shouldForceActionChoice,
shouldRedirectOrdinaryChatToHealth,
} from './health-intent-rules.mjs';
test('rule hits blood pressure pairs without LLM', () => {
const hit = matchHealthIdleRules('血压 137/82');
assert.equal(hit.matched, true);
assert.equal(hit.extracted.systolic, 137);
assert.equal(hit.extracted.diastolic, 82);
assert.equal(shouldForceActionChoice(hit), false);
});
test('unmatched chatter forces a menu', () => {
const miss = matchHealthIdleRules('帮我看看明天天气');
assert.equal(miss.matched, false);
assert.equal(shouldForceActionChoice(miss, { confidence: 0.4, top1: 0.4, top2: 0.35 }), true);
});
test('ordinary chat health phrases only redirect and never imply a write', () => {
assert.equal(shouldRedirectOrdinaryChatToHealth('帮我记一下血压 128/76'), true);
assert.equal(shouldRedirectOrdinaryChatToHealth('做个旅游攻略页面'), false);
});