feat(wechat): send rich subscribe welcome with clickable intro and bind links
Memind CI / Test, build, and release guards (push) Has been cancelled

New followers receive capability overview plus WeChat anchor links for the
deep intro page and account binding instead of exposing raw URLs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-28 09:39:06 +08:00
parent 760a1760ae
commit f91ee97502
4 changed files with 91 additions and 1 deletions
+45
View File
@@ -0,0 +1,45 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {
buildSubscribeWelcomeText,
buildWechatTextLink,
DEFAULT_PRODUCTION_BIND_URL,
DEFAULT_SUBSCRIBE_INTRO_URL,
} 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, /📖 了解更多:/);
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.match(text, /帮我做一个读书笔记页面/);
});
test('buildSubscribeWelcomeText omits intro section when introUrl is empty', () => {
const text = buildSubscribeWelcomeText({
bindUrl: 'https://m.tkmind.cn/bind',
introUrl: '',
});
assert.doesNotMatch(text, /📖 了解更多:/);
assert.doesNotMatch(text, /tkmind-deep-intro\.html/);
});