d07815d317
Memind CI / Test, build, and release guards (push) Successful in 6m17s
Replace category links with Xinjiang travel, Plaza late-night food, and creative landing pages; sync missing E2E deps on 103 runtime. Co-authored-by: Cursor <cursoragent@cursor.com>
95 lines
3.1 KiB
JavaScript
95 lines
3.1 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
buildPlazaDiscoveryLines,
|
|
buildSubscribeWelcomeText,
|
|
buildWechatTextLink,
|
|
DEFAULT_PLAZA_HOME_URL,
|
|
DEFAULT_PRODUCTION_BIND_URL,
|
|
DEFAULT_SUBSCRIBE_INTRO_URL,
|
|
DEFAULT_SUBSCRIBE_PLAZA_PICKS,
|
|
} from './sync-replies.mjs';
|
|
|
|
test('buildWechatTextLink renders WeChat anchor without exposing raw url', () => {
|
|
assert.equal(
|
|
buildWechatTextLink(DEFAULT_PRODUCTION_BIND_URL, '点我绑定'),
|
|
`<a href="${DEFAULT_PRODUCTION_BIND_URL}">点我绑定</a>`,
|
|
);
|
|
});
|
|
|
|
test('buildSubscribeWelcomeText uses clickable anchors instead of raw urls', () => {
|
|
const text = buildSubscribeWelcomeText({ bindUrl: DEFAULT_PRODUCTION_BIND_URL });
|
|
|
|
assert.match(text, /欢迎关注 TKMind 智趣/);
|
|
assert.match(text, /生成精美网页并给链接/);
|
|
assert.match(text, /🎯 M发现 · 精选作品广场/);
|
|
assert.match(text, /旅行攻略/);
|
|
assert.match(text, /深夜食堂/);
|
|
assert.match(
|
|
text,
|
|
new RegExp(`<a href="${DEFAULT_PLAZA_HOME_URL.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}">进入 M发现,逛热门作品</a>`),
|
|
);
|
|
assert.match(text, /📖 了解 TKMind 能做什么:/);
|
|
assert.match(
|
|
text,
|
|
/<a href="[^"]*tkmind-deep-intro\.html">看功能介绍<\/a>/,
|
|
);
|
|
assert.match(text, /👉 先完成绑定再开始对话:/);
|
|
assert.match(
|
|
text,
|
|
/<a href="[^"]*auth\/wechat\/authorize\?intent=login">点我绑定<\/a>/,
|
|
);
|
|
assert.doesNotMatch(text, /\nhttps:\/\/m\.tkmind\.cn/);
|
|
assert.doesNotMatch(text, /\nhttps:\/\/plaza\.tkmind\.cn/);
|
|
assert.match(text, /帮我做一个苏州游玩攻略页面/);
|
|
assert.match(text, /☀️ 每日早安提醒/);
|
|
assert.match(text, /回复 1 确认/);
|
|
assert.match(text, /1 7点/);
|
|
assert.match(text, /取消早安/);
|
|
});
|
|
|
|
test('buildPlazaDiscoveryLines renders curated plaza category links', () => {
|
|
const lines = buildPlazaDiscoveryLines();
|
|
const text = lines.join('\n');
|
|
assert.match(text, /M发现/);
|
|
for (const pick of DEFAULT_SUBSCRIBE_PLAZA_PICKS) {
|
|
assert.ok(text.includes(pick.label));
|
|
assert.ok(text.includes(`<a href="${pick.url}">${pick.label}</a>`));
|
|
}
|
|
});
|
|
|
|
test('buildSubscribeWelcomeText omits intro section when introUrl is empty', () => {
|
|
const text = buildSubscribeWelcomeText({
|
|
bindUrl: 'https://m.tkmind.cn/bind',
|
|
introUrl: '',
|
|
});
|
|
|
|
assert.doesNotMatch(text, /📖 了解 TKMind 能做什么:/);
|
|
assert.doesNotMatch(text, /tkmind-deep-intro\.html/);
|
|
});
|
|
|
|
test('buildSubscribeWelcomeText omits plaza section when plazaHomeUrl is empty', () => {
|
|
const text = buildSubscribeWelcomeText({
|
|
bindUrl: 'https://m.tkmind.cn/bind',
|
|
introUrl: '',
|
|
plazaHomeUrl: '',
|
|
plazaPicks: [],
|
|
});
|
|
|
|
assert.doesNotMatch(text, /M发现/);
|
|
});
|
|
|
|
test('buildSubscribeWelcomeText omits morning reminder when disabled', () => {
|
|
const text = buildSubscribeWelcomeText({
|
|
bindUrl: 'https://m.tkmind.cn/bind',
|
|
introUrl: '',
|
|
plazaHomeUrl: '',
|
|
plazaPicks: [],
|
|
morningReminderEnabled: false,
|
|
});
|
|
|
|
assert.doesNotMatch(text, /每日早安提醒/);
|
|
assert.doesNotMatch(text, /回复 1 确认/);
|
|
});
|