Files
memind/wechat/intent/channel-prefix.test.mjs
T
john 8f88eec2bd
Memind CI / Test, build, and release guards (push) Successful in 4m40s
Separate WeChat chat, page refine, and task flows with explicit routing.
Add channel prefixes, pin edit targets in Cursor prompts, and force fresh sessions for page refine URLs so DeepSeek/Goose chat history does not pollute page tasks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-31 14:10:02 +08:00

30 lines
1.2 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import {
parseWechatChannelPrefix,
stripWechatChannelPrefix,
WECHAT_CHANNEL_PREFIX,
} from './channel-prefix.mjs';
test('parseWechatChannelPrefix strips chat prefix', () => {
const parsed = parseWechatChannelPrefix('【聊天】上海明天天气怎么样');
assert.equal(parsed.channel, WECHAT_CHANNEL_PREFIX.CHAT);
assert.equal(parsed.body, '上海明天天气怎么样');
});
test('parseWechatChannelPrefix strips page refine prefix', () => {
const parsed = parseWechatChannelPrefix('【改页】public/demo.html 补充时间节点');
assert.equal(parsed.channel, WECHAT_CHANNEL_PREFIX.PAGE);
assert.match(parsed.body, /public\/demo\.html/);
});
test('parseWechatChannelPrefix strips scheduled task prefix', () => {
const parsed = parseWechatChannelPrefix('【定时任务】列出我进行中的任务');
assert.equal(parsed.channel, WECHAT_CHANNEL_PREFIX.SCHEDULED_TASK);
assert.equal(parsed.body, '列出我进行中的任务');
});
test('stripWechatChannelPrefix leaves unprefixed text unchanged', () => {
assert.equal(stripWechatChannelPrefix('帮我做嵊泗攻略'), '帮我做嵊泗攻略');
});