Publish saved Studio pages as atomic Wiki posts and document agent editing

This commit is contained in:
2026-10-27 17:37:22 +08:00
parent c423accb59
commit 3069a797b4
9 changed files with 159 additions and 22 deletions
@@ -44,7 +44,7 @@ test('normal calls and mutations do not enter documentation mode',()=>{
test('index exposes every business endpoint and its text URL',()=>{
const {state,res}=response();index(request('GET','True'),res);
for(const path of [...Object.keys(apiDocuments),'/studio/api/export/{slug}','/studio/api/health'])assert.ok(String(state.body).includes(path+'?agent_mode=True'));
for(const path of [...Object.keys(apiDocuments),'/studio/api/export/{slug}','/studio/api/health','/api/studio/designs','/api/studio/designs/{id}','/api/studio/designs/{id}/post'])assert.ok(String(state.body).includes(path+'?agent_mode=True'));
});
test('health keeps its regular JSON response',async()=>{
@@ -53,3 +53,12 @@ test('health keeps its regular JSON response',async()=>{
assert.equal(state.status,200);assert.equal((state.body as {status:string}).status,'ok');
});
test('Studio docs describe native editing and atomic Wiki publication without accessing storage',async()=>{
for(const route of ['studio/designs/index','studio/designs/[id]','studio/designs/[id]/post']){
const {default:handler}=await import('../src/pages/api/'+route+'.ts');
const {state,res}=response();await handler(request('GET','True'),res);
assert.equal(state.status,200);assert.match(String(state.body),/postUrl/);assert.match(String(state.body),/整体替换/);assert.match(String(state.body),/同一数据库事务/);assert.match(String(state.body),/原生页面/);
}
});