53 lines
2.7 KiB
TypeScript
53 lines
2.7 KiB
TypeScript
/**
|
|
* Ad-hoc test for the feature Meego-link expansion (createFeature's fetch step).
|
|
* Runs the REAL expandMeegoLinks against a description that mixes:
|
|
* - two real past-bug Meego work-item links (different projects)
|
|
* - one Lark doc link (must pass through untouched — handled by the agent skill)
|
|
* - some prose + a bare number (must be ignored)
|
|
* Prints the appended description + the combined attachment manifest.
|
|
*
|
|
* Run: bun scripts/test_feature_meego_parse.ts
|
|
*/
|
|
import { expandMeegoLinks } from "../control-server/src/feature_importer";
|
|
|
|
const MEEGO_A = "https://meego.larkoffice.com/tiktok/issue/detail/7357180292";
|
|
const MEEGO_B = "https://meego.larkoffice.com/tiktok_live/issue/detail/7356610293";
|
|
const LARK = "https://bytedance.us.larkoffice.com/docx/XFLEdHT7BoS0dCxSvG0ukKj9sbe";
|
|
|
|
const description = [
|
|
"在收件箱顶部增加「说句悄悄话」快捷心情入口,让用户一键发布预设状态。",
|
|
"",
|
|
`需求详情见 Meego: ${MEEGO_A}`,
|
|
`关联的直播侧异常单: ${MEEGO_B}`,
|
|
`PRD 设计文档(飞书): ${LARK}`,
|
|
"验收编号 12345 仅为业务序号,不是工单。",
|
|
].join("\n");
|
|
|
|
console.log("═══════════ INPUT description ═══════════");
|
|
console.log(description);
|
|
|
|
const res = await expandMeegoLinks(description);
|
|
|
|
console.log("\n═══════════ OUTPUT description (original + appended) ═══════════");
|
|
console.log(res.description);
|
|
|
|
console.log("\n═══════════ attachments manifest ═══════════");
|
|
console.log(JSON.stringify(res.attachments, null, 2));
|
|
|
|
console.log("\n═══════════ assertions ═══════════");
|
|
const outStr = res.description;
|
|
const check = (name: string, ok: boolean) => console.log(`${ok ? "✅" : "❌"} ${name}`);
|
|
check("original description preserved verbatim at head", outStr.startsWith(description));
|
|
check("Meego A expanded (fence present)", outStr.includes(`===${MEEGO_A} 实际内容===`));
|
|
check("Meego B expanded (fence present)", outStr.includes(`===${MEEGO_B} 实际内容===`));
|
|
check("Lark link NOT expanded (no fence)", !outStr.includes(`===${LARK} 实际内容===`));
|
|
check("Lark link still present as plain text", outStr.includes(LARK));
|
|
check("no stub leaked into output", !/\[stub\]|Cannot derive|Unparseable/.test(outStr));
|
|
if (res.attachments) {
|
|
const all = [...res.attachments.inlineImages, ...res.attachments.attachments];
|
|
check("every attachment entry carries a source link", all.every((e) => !!e.link));
|
|
console.log(` inlineImages=${res.attachments.inlineImages.length} attachments=${res.attachments.attachments.length}`);
|
|
}
|
|
|
|
process.exit(0);
|