11import assert from 'node:assert/strict' ;
2- import { describe , it } from 'node:test' ;
2+ import { describe , it , mock } from 'node:test' ;
3+
4+ // Mock remark
5+ mock . module ( '../../../../utils/remark.mjs' , {
6+ namedExports : {
7+ getRemarkRecma : ( ) => ( {
8+ runSync : ( ) => ( {
9+ body : [ { expression : 'mock-expression' } ] ,
10+ } ) ,
11+ } ) ,
12+ } ,
13+ } ) ;
314
4- import {
15+ const {
516 classifyTypeNode,
617 extractPropertyName,
718 extractTypeAnnotations,
819 parseListIntoProperties,
9- } from '../types.mjs' ;
10-
11- // Mock remark processor for tests
12- const remark = {
13- runSync : ( ) => ( {
14- body : [ { expression : 'mock-expression' } ] ,
15- } ) ,
16- } ;
20+ } = await import ( '../types.mjs' ) ;
1721
1822describe ( 'classifyTypeNode' , ( ) => {
1923 it ( 'returns 2 for union separator text node' , ( ) => {
@@ -183,7 +187,7 @@ describe('extractTypeAnnotations', () => {
183187 { type : 'text' , value : ' description follows' } ,
184188 ] ;
185189
186- const result = extractTypeAnnotations ( nodes , remark ) ;
190+ const result = extractTypeAnnotations ( nodes ) ;
187191
188192 assert . strictEqual ( result , 'mock-expression' ) ;
189193 assert . strictEqual ( nodes . length , 1 ) ;
@@ -204,7 +208,7 @@ describe('extractTypeAnnotations', () => {
204208 { type : 'text' , value : ' description' } ,
205209 ] ;
206210
207- const result = extractTypeAnnotations ( nodes , remark ) ;
211+ const result = extractTypeAnnotations ( nodes ) ;
208212
209213 assert . strictEqual ( result , 'mock-expression' ) ;
210214 assert . strictEqual ( nodes . length , 1 ) ;
@@ -220,7 +224,7 @@ describe('extractTypeAnnotations', () => {
220224 { type : 'text' , value : ' | ' } ,
221225 ] ;
222226
223- const result = extractTypeAnnotations ( nodes , remark ) ;
227+ const result = extractTypeAnnotations ( nodes ) ;
224228
225229 assert . strictEqual ( result , 'mock-expression' ) ;
226230 assert . strictEqual ( nodes . length , 0 ) ;
@@ -232,7 +236,7 @@ describe('extractTypeAnnotations', () => {
232236 { type : 'emphasis' , children : [ { type : 'text' , value : 'emphasized' } ] } ,
233237 ] ;
234238
235- const result = extractTypeAnnotations ( nodes , remark ) ;
239+ const result = extractTypeAnnotations ( nodes ) ;
236240
237241 assert . strictEqual ( result , undefined ) ;
238242 assert . strictEqual ( nodes . length , 2 ) ;
@@ -248,7 +252,7 @@ describe('extractTypeAnnotations', () => {
248252 { type : 'text' , value : ' | ' } , // This shouldn't be consumed
249253 ] ;
250254
251- const result = extractTypeAnnotations ( nodes , remark ) ;
255+ const result = extractTypeAnnotations ( nodes ) ;
252256
253257 assert . strictEqual ( result , 'mock-expression' ) ;
254258 assert . strictEqual ( nodes . length , 2 ) ;
@@ -259,7 +263,7 @@ describe('extractTypeAnnotations', () => {
259263 it ( 'handles empty nodes array' , ( ) => {
260264 const nodes = [ ] ;
261265
262- const result = extractTypeAnnotations ( nodes , remark ) ;
266+ const result = extractTypeAnnotations ( nodes ) ;
263267
264268 assert . strictEqual ( result , undefined ) ;
265269 assert . strictEqual ( nodes . length , 0 ) ;
@@ -275,7 +279,7 @@ describe('extractTypeAnnotations', () => {
275279 { type : 'text' , value : ' description' } ,
276280 ] ;
277281
278- const result = extractTypeAnnotations ( nodes , remark ) ;
282+ const result = extractTypeAnnotations ( nodes ) ;
279283
280284 assert . strictEqual ( result , 'mock-expression' ) ;
281285 assert . strictEqual ( nodes . length , 1 ) ;
@@ -300,7 +304,7 @@ describe('parseListIntoProperties', () => {
300304 ] ,
301305 } ;
302306
303- const result = parseListIntoProperties ( node , remark ) ;
307+ const result = parseListIntoProperties ( node ) ;
304308
305309 assert . deepStrictEqual ( result , [
306310 {
@@ -333,7 +337,7 @@ describe('parseListIntoProperties', () => {
333337 ] ,
334338 } ;
335339
336- const result = parseListIntoProperties ( node , remark ) ;
340+ const result = parseListIntoProperties ( node ) ;
337341
338342 assert . deepStrictEqual ( result , [
339343 {
@@ -362,7 +366,7 @@ describe('parseListIntoProperties', () => {
362366 ] ,
363367 } ;
364368
365- const result = parseListIntoProperties ( node , remark ) ;
369+ const result = parseListIntoProperties ( node ) ;
366370
367371 assert . deepStrictEqual ( result , [
368372 {
@@ -388,7 +392,7 @@ describe('parseListIntoProperties', () => {
388392 ] ,
389393 } ;
390394
391- const result = parseListIntoProperties ( node , remark ) ;
395+ const result = parseListIntoProperties ( node ) ;
392396
393397 assert . deepStrictEqual ( result , [
394398 {
@@ -416,7 +420,7 @@ describe('parseListIntoProperties', () => {
416420 ] ,
417421 } ;
418422
419- const result = parseListIntoProperties ( node , remark ) ;
423+ const result = parseListIntoProperties ( node ) ;
420424
421425 assert . deepStrictEqual ( result , [
422426 {
@@ -460,7 +464,7 @@ describe('parseListIntoProperties', () => {
460464 ] ,
461465 } ;
462466
463- const result = parseListIntoProperties ( node , remark ) ;
467+ const result = parseListIntoProperties ( node ) ;
464468
465469 assert . deepStrictEqual ( result , [
466470 {
@@ -507,7 +511,7 @@ describe('parseListIntoProperties', () => {
507511 ] ,
508512 } ;
509513
510- const result = parseListIntoProperties ( node , remark ) ;
514+ const result = parseListIntoProperties ( node ) ;
511515
512516 assert . deepStrictEqual ( result , [
513517 {
@@ -542,7 +546,7 @@ describe('parseListIntoProperties', () => {
542546 ] ,
543547 } ;
544548
545- const result = parseListIntoProperties ( node , remark ) ;
549+ const result = parseListIntoProperties ( node ) ;
546550
547551 assert . deepStrictEqual ( result , [
548552 {
@@ -561,7 +565,7 @@ describe('parseListIntoProperties', () => {
561565 children : [ ] ,
562566 } ;
563567
564- const result = parseListIntoProperties ( node , remark ) ;
568+ const result = parseListIntoProperties ( node ) ;
565569
566570 assert . deepStrictEqual ( result , [ ] ) ;
567571 } ) ;
@@ -605,7 +609,7 @@ describe('parseListIntoProperties', () => {
605609 ] ,
606610 } ;
607611
608- const result = parseListIntoProperties ( node , remark ) ;
612+ const result = parseListIntoProperties ( node ) ;
609613 assert . deepStrictEqual ( result , [
610614 {
611615 children : [
0 commit comments