Replace approximate recipes with 27 source-matched component layouts
wiki CI and deployment / verify-and-deploy (push) Successful in 16m40s
wiki CI and deployment / verify-and-deploy (push) Successful in 16m40s
This commit is contained in:
@@ -5,7 +5,7 @@ import {pageId,previewUrl} from '../src/content/page-links';
|
||||
import {guidanceDocuments} from '../src/content/skills/guidance';
|
||||
import {getServerSideProps} from '../src/pages/explore/[id]';
|
||||
test('every public document has a distinct persisted ID and canonical entry',async()=>{assert.equal(new Set(staticEntries.map(e=>e.id)).size,staticEntries.length);for(const e of staticEntries){assert.match(e.id,/^[a-f0-9]{24}$/);assert.equal((await getEntry(e.id))?.title,e.title);}for(const doc of guidanceDocuments)assert.ok(pageId('guidance:'+doc.path));assert.equal(await getEntry('unknown'),null);});
|
||||
test('agent_mode on the canonical URL emits text with media links and no HTML',async()=>{const entry=staticEntries.find(e=>e.media.length)!;let body='';const headers:Record<string,string>={};const response={setHeader:(k:string,v:string)=>headers[k]=v,end:(value:string)=>{body=value}};await getServerSideProps({params:{id:entry.id},query:{agent_mode:'True'},res:response,req:{method:'GET'}} as never);assert.match(headers['Content-Type'],/text\/plain/);assert.ok(body.includes(entry.title));assert.ok(body.includes(entry.media[0].url));assert.ok(!body.includes('<img'));assert.ok(!body.includes('!['));assert.equal(body,entryText((await getEntry(entry.id))!));});
|
||||
test('agent_mode on the canonical URL emits text with media links and no HTML',async()=>{const entry=staticEntries.find(e=>e.media.length)!;let body='';const headers:Record<string,string>={};const response={setHeader:(k:string,v:string)=>headers[k]=v,end:(value:string)=>{body=value}};await getServerSideProps({params:{id:entry.id},query:{agent_mode:'True'},res:response,req:{method:'GET'}} as never);assert.match(headers['Content-Type'],/text\/plain/);assert.ok(body.includes(entry.title));assert.ok(body.includes(entry.media[0].url));assert.ok(body.startsWith('# '+entry.title));assert.ok(!body.includes('!['));assert.equal(body,entryText((await getEntry(entry.id))!));});
|
||||
test('preview URLs always use bounded image endpoints',()=>{const url=new URL(previewUrl('/api/media/id?variant=poster',480),'http://test');assert.equal(url.pathname,'/api/preview');assert.equal(url.searchParams.get('source'),'/api/media/id?variant=poster');assert.equal(url.searchParams.get('width'),'480');});
|
||||
|
||||
test('independent notes expose their own description, tags and complete image counts',async()=>{
|
||||
@@ -17,14 +17,14 @@ test('independent notes expose their own description, tags and complete image co
|
||||
});
|
||||
|
||||
test('agent text preserves tutorial HTML and TSX code without returning an HTML page',async()=>{
|
||||
const entry=(await getEntry(pageId('guidance:premium-layout/offset-panels')))!;
|
||||
const entry=(await getEntry(pageId('guidance:premium-layout/ref-01')))!;
|
||||
let body='';const headers:Record<string,string>={};
|
||||
const response={setHeader:(k:string,v:string)=>headers[k]=v,end:(value:string)=>{body=value}};
|
||||
await getServerSideProps({params:{id:entry.id},query:{agent_mode:'True'},res:response,req:{method:'GET'}} as never);
|
||||
assert.match(headers['Content-Type'],/text\/plain/);
|
||||
assert.ok(body.startsWith('# '+entry.title));
|
||||
assert.match(body,/```\n<!doctype html>\n<html lang="zh-CN">/);
|
||||
assert.ok(body.includes('export default function LayoutPoster'));
|
||||
assert.ok(body.includes('app/designs/offset-panels/page.tsx'));
|
||||
assert.ok(body.includes('export default function Example'));
|
||||
assert.ok(body.includes('app/designs/ref-01/page.tsx'));
|
||||
assert.equal(body,entryText(entry));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user