Files
memind/mindspace-public-share-widget.test.mjs
john e2ad3bf62b feat(mindspace): 公开页分享组件、workspace 路径与 Plaza 发布增强
- 新增 public share widget 与 workspace relative path 解析
- 增强 publications/chat-plaza 发布链路与缩略图 demo
- 补充 schema、cover 检查脚本与回归测试

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-05 23:14:41 +08:00

21 lines
1.1 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { injectPublicFileShareButton } from './mindspace-public-share-widget.mjs';
test('injectPublicFileShareButton adds plaza entry and confirm dialog', () => {
const result = injectPublicFileShareButton('<!doctype html><html><body><h1>Hi</h1></body></html>');
assert.match(result.html, /data-action="plaza"/);
assert.match(result.html, /发布到 Plaza/);
assert.match(result.html, /data-action="plaza-confirm"/);
assert.match(result.html, /quick-plaza-from-public-html/);
assert.match(result.html, /quick-plaza-from-public-html\/status/);
assert.match(result.html, /data-plaza-view="already"/);
assert.match(result.html, /已在广场发布/);
assert.match(result.html, /data-mindspace-public-share-dialog-panel role="dialog"/);
assert.doesNotMatch(result.html, /data-mindspace-public-share-dialog-panel"/);
assert.match(result.html, /color:#fff !important/);
assert.match(result.html, /apiErrorBody/);
assert.match(result.html, /ALREADY_PUBLISHED/);
assert.equal(result.scriptHashes.length, 1);
});