Files
memind/schedule-utterance-normalize.test.mjs
T
john 9dfafb99ca
Memind CI / Test, build, and release guards (push) Successful in 3m43s
fix(schedule): harden reminder utterance routing for WeChat ITL
Expand ASR normalization and colloquial reminder parsing so simple timed reminders route to L1 confirm cards instead of the agent, and disable schedule-guard false failures when ITL is enabled.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 18:02:19 +08:00

28 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import assert from 'node:assert/strict';
import test from 'node:test';
import {
hasReminderSetupCue,
isWeeklyScheduleCue,
normalizeScheduleUtterance,
} from './schedule-utterance-normalize.mjs';
test('normalizeScheduleUtterance fixes ASR spaced colons and fullwidth digits', () => {
assert.equal(normalizeScheduleUtterance('下午 17 08 开会'), '下午 17:08 开会');
assert.equal(normalizeScheduleUtterance('18 00'), '18:00');
});
test('hasReminderSetupCue recognizes common colloquial reminder phrases', () => {
const compact = (text) => String(text).replace(/\s+/g, '');
assert.equal(hasReminderSetupCue(compact('加个提醒明天9点开会')), true);
assert.equal(hasReminderSetupCue(compact('添加提醒后天10点体检')), true);
assert.equal(hasReminderSetupCue(compact('定个闹钟明天7点')), true);
assert.equal(hasReminderSetupCue(compact('备忘提醒下午3点交报告')), true);
assert.equal(hasReminderSetupCue(compact('设置每天18点提醒打卡')), true);
assert.equal(hasReminderSetupCue(compact('每天6点帮我做今日新闻页面')), false);
});
test('isWeeklyScheduleCue detects weekly recurrence wording', () => {
assert.equal(isWeeklyScheduleCue('每周一早上9点提醒我开会'), true);
assert.equal(isWeeklyScheduleCue('明天9点提醒我开会'), false);
});