6ee6fd64dd
Introduce page edit sessions with draft preview and patch API, chat skill picker, user memory profile, h5ApiBase resolution, voice WAV transport, and scripts for 105/g2 deployment and Plaza local dev. Co-authored-by: Cursor <cursoragent@cursor.com>
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import {
|
|
buildMindSpacePageSaveInstructions,
|
|
extractMindSpacePagePatch,
|
|
mergeMindSpacePagePatch,
|
|
} from './mindspace-page-patch.mjs';
|
|
|
|
test('extractMindSpacePagePatch parses assistant update block', () => {
|
|
const text = `好的,标题已更新。
|
|
|
|
\`\`\`mindspace-page-update
|
|
{"title":"新标题","summary":"新摘要"}
|
|
\`\`\``;
|
|
assert.deepEqual(extractMindSpacePagePatch(text), {
|
|
title: '新标题',
|
|
summary: '新摘要',
|
|
});
|
|
});
|
|
|
|
test('mergeMindSpacePagePatch keeps unchanged fields', () => {
|
|
assert.deepEqual(
|
|
mergeMindSpacePagePatch(
|
|
{ title: '旧标题', summary: '旧摘要', content: '正文' },
|
|
{ title: '新标题' },
|
|
),
|
|
{ title: '新标题', summary: '旧摘要', content: '正文' },
|
|
);
|
|
});
|
|
|
|
test('buildMindSpacePageSaveInstructions mentions page id and block format', () => {
|
|
const lines = buildMindSpacePageSaveInstructions({
|
|
id: 'page-1',
|
|
contentFormat: 'markdown',
|
|
});
|
|
assert.match(lines.join('\n'), /page-1/);
|
|
assert.match(lines.join('\n'), /mindspace-page-update/);
|
|
});
|