77import { assertEquals , assertStringIncludes } from 'jsr:@std/assert@^1.0.0' ;
88import { renderDSD } from '../src/render-dsd.ts' ;
99import { registerAdapter } from '../src/adapter-registry.ts' ;
10- import type { RenderHooks , RenderOutput , RenderInput , RenderError } from '../src/types.ts' ;
10+ import type { RenderError , RenderHooks , RenderInput , RenderOutput } from '../src/types.ts' ;
1111
1212// ─── Mock Component Classes ──────────────────────────────────
1313
@@ -89,7 +89,16 @@ Deno.test('RenderHooks — beforeRender', async (t) => {
8989 } ,
9090 } ;
9191
92- await renderDSD ( 'hook-test-2' , asCtor ( cls ) , { name : 'test' } , undefined , undefined , undefined , 0 , hooks ) ;
92+ await renderDSD (
93+ 'hook-test-2' ,
94+ asCtor ( cls ) ,
95+ { name : 'test' } ,
96+ undefined ,
97+ undefined ,
98+ undefined ,
99+ 0 ,
100+ hooks ,
101+ ) ;
93102
94103 assertEquals ( receivedInput ! . tagName , 'hook-test-2' ) ;
95104 assertEquals ( receivedInput ! . props . name , 'test' ) ;
@@ -107,7 +116,16 @@ Deno.test('RenderHooks — beforeRender', async (t) => {
107116 } ;
108117
109118 // Should not throw — hook errors are caught silently
110- const output = await renderDSD ( 'hook-test-3' , asCtor ( cls ) , { } , undefined , undefined , undefined , 0 , hooks ) ;
119+ const output = await renderDSD (
120+ 'hook-test-3' ,
121+ asCtor ( cls ) ,
122+ { } ,
123+ undefined ,
124+ undefined ,
125+ undefined ,
126+ 0 ,
127+ hooks ,
128+ ) ;
111129 assertStringIncludes ( output . html , '<p>Hello</p>' ) ;
112130 } ) ;
113131} ) ;
@@ -236,7 +254,16 @@ Deno.test('RenderHooks — optional (undefined)', async (t) => {
236254 registerAdapter ( undefined ) ;
237255 const cls = createMockClass ( '<p>No hooks</p>' ) ;
238256
239- const output = await renderDSD ( 'hook-test-10' , asCtor ( cls ) , { } , undefined , undefined , undefined , 0 , undefined ) ;
257+ const output = await renderDSD (
258+ 'hook-test-10' ,
259+ asCtor ( cls ) ,
260+ { } ,
261+ undefined ,
262+ undefined ,
263+ undefined ,
264+ 0 ,
265+ undefined ,
266+ ) ;
240267
241268 assertStringIncludes ( output . html , '<p>No hooks</p>' ) ;
242269 assertEquals ( output . errors . length , 0 ) ;
@@ -246,7 +273,16 @@ Deno.test('RenderHooks — optional (undefined)', async (t) => {
246273 registerAdapter ( undefined ) ;
247274 const cls = createMockClass ( '<p>Empty hooks</p>' ) ;
248275
249- const output = await renderDSD ( 'hook-test-11' , asCtor ( cls ) , { } , undefined , undefined , undefined , 0 , { } ) ;
276+ const output = await renderDSD (
277+ 'hook-test-11' ,
278+ asCtor ( cls ) ,
279+ { } ,
280+ undefined ,
281+ undefined ,
282+ undefined ,
283+ 0 ,
284+ { } ,
285+ ) ;
250286
251287 assertStringIncludes ( output . html , '<p>Empty hooks</p>' ) ;
252288 assertEquals ( output . errors . length , 0 ) ;
@@ -256,8 +292,26 @@ Deno.test('RenderHooks — optional (undefined)', async (t) => {
256292 registerAdapter ( undefined ) ;
257293 const cls = createMockClass ( '<p>Same behavior</p>' ) ;
258294
259- const withHooks = await renderDSD ( 'hook-test-12a' , asCtor ( cls ) , { } , undefined , undefined , undefined , 0 , { } ) ;
260- const withoutHooks = await renderDSD ( 'hook-test-12b' , asCtor ( cls ) , { } , undefined , undefined , undefined , 0 , undefined ) ;
295+ const withHooks = await renderDSD (
296+ 'hook-test-12a' ,
297+ asCtor ( cls ) ,
298+ { } ,
299+ undefined ,
300+ undefined ,
301+ undefined ,
302+ 0 ,
303+ { } ,
304+ ) ;
305+ const withoutHooks = await renderDSD (
306+ 'hook-test-12b' ,
307+ asCtor ( cls ) ,
308+ { } ,
309+ undefined ,
310+ undefined ,
311+ undefined ,
312+ 0 ,
313+ undefined ,
314+ ) ;
261315
262316 // HTML output should be identical (except for tag name differences)
263317 assertEquals ( withHooks . errors . length , withoutHooks . errors . length ) ;
@@ -268,30 +322,33 @@ Deno.test('RenderHooks — optional (undefined)', async (t) => {
268322// ─── RenderOutput shape ─────────────────────────────────────
269323
270324Deno . test ( 'RenderOutput — structured output' , async ( t ) => {
271- await t . step ( 'successful render returns RenderOutput with html, errors, metrics, hydrationHints' , async ( ) => {
272- registerAdapter ( undefined ) ;
273- const cls = createMockClass ( '<p>Full output</p>' ) ;
274-
275- const output = await renderDSD ( 'output-test-1' , asCtor ( cls ) , { name : 'test' } ) ;
276-
277- // html
278- assertStringIncludes ( output . html , 'output-test-1' ) ;
279- assertStringIncludes ( output . html , '<p>Full output</p>' ) ;
280- assertStringIncludes ( output . html , 'name="test"' ) ;
281-
282- // errors
283- assertEquals ( output . errors . length , 0 ) ;
284-
285- // metrics
286- assertEquals ( output . metrics . tagName , 'output-test-1' ) ;
287- assertEquals ( typeof output . metrics . renderTimeMs , 'number' ) ;
288- assertEquals ( output . metrics . layer , 'dsd-static' ) ;
289- assertEquals ( output . metrics . hasError , false ) ;
290- assertEquals ( output . metrics . nestingDepth , 0 ) ;
291-
292- // hydrationHints
293- assertEquals ( Array . isArray ( output . hydrationHints ) , true ) ;
294- } ) ;
325+ await t . step (
326+ 'successful render returns RenderOutput with html, errors, metrics, hydrationHints' ,
327+ async ( ) => {
328+ registerAdapter ( undefined ) ;
329+ const cls = createMockClass ( '<p>Full output</p>' ) ;
330+
331+ const output = await renderDSD ( 'output-test-1' , asCtor ( cls ) , { name : 'test' } ) ;
332+
333+ // html
334+ assertStringIncludes ( output . html , 'output-test-1' ) ;
335+ assertStringIncludes ( output . html , '<p>Full output</p>' ) ;
336+ assertStringIncludes ( output . html , 'name="test"' ) ;
337+
338+ // errors
339+ assertEquals ( output . errors . length , 0 ) ;
340+
341+ // metrics
342+ assertEquals ( output . metrics . tagName , 'output-test-1' ) ;
343+ assertEquals ( typeof output . metrics . renderTimeMs , 'number' ) ;
344+ assertEquals ( output . metrics . layer , 'dsd-static' ) ;
345+ assertEquals ( output . metrics . hasError , false ) ;
346+ assertEquals ( output . metrics . nestingDepth , 0 ) ;
347+
348+ // hydrationHints
349+ assertEquals ( Array . isArray ( output . hydrationHints ) , true ) ;
350+ } ,
351+ ) ;
295352
296353 await t . step ( 'failed render returns RenderOutput with errors' , async ( ) => {
297354 registerAdapter ( undefined ) ;
0 commit comments