Files
memind/schedule-intent.test.mjs
T
john 229805a070 Improve WeChat MP replies and ship MindSpace/H5 production updates.
Add WeChat service account routing with sync acks, connectivity tests, and context isolation; document deploy runbooks; and bundle related MindSpace, voice, Plaza, and server gateway changes for production rollout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-19 23:06:43 +08:00

24 lines
1.0 KiB
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { parseScheduleIntent } from './schedule-intent.mjs';
import { nextDailyRunAt } from './schedule-time.mjs';
test('parses daily 7am todo digest request', () => {
const intent = parseScheduleIntent('每天早上 7 点给我发一天的待办记录');
assert.equal(intent.action, 'create_daily_todo_digest');
assert.equal(intent.hour, 7);
assert.equal(intent.minute, 0);
});
test('daily todo digest asks for time when missing', () => {
const intent = parseScheduleIntent('每天给我发一天的待办记录');
assert.equal(intent.action, 'create_daily_todo_digest');
assert.deepEqual(intent.needsClarification, ['digest_time']);
});
test('nextDailyRunAt rolls to tomorrow when today time has passed', () => {
const now = Date.UTC(2026, 5, 17, 23, 30, 0); // 2026-06-18 07:30 Asia/Shanghai
const next = nextDailyRunAt({ hour: 7, minute: 0, timezone: 'Asia/Shanghai', now });
assert.equal(next, Date.UTC(2026, 5, 18, 23, 0, 0)); // 2026-06-19 07:00 Asia/Shanghai
});