@@ -30,6 +30,8 @@ vi.mock('overtype', () => {
3030} ) 
3131
3232import  {  describe  as  baseDescribe ,  test  as  baseTest ,  expect  }  from  'vitest' 
33+ import  type  {  StrippedLocation  }  from  '@/lib/enhancer' 
34+ import  {  EnhancerRegistry  }  from  '../src/lib/registries' 
3335import  type  {  CORPUS  }  from  './corpus/_corpus-index' 
3436import  {  cleanupDOM ,  setupDOM  }  from  './corpus-utils' 
3537
@@ -38,6 +40,26 @@ export const describe = baseDescribe
3840// Re-export expect from vitest 
3941export  {  expect  } 
4042
43+ // Helper function for detection tests 
44+ export  function  getDetectionResults ( document : Document ,  window : Window )  { 
45+   const  enhancers  =  new  EnhancerRegistry ( ) 
46+   const  textareas  =  document . querySelectorAll ( 'textarea' ) 
47+   const  location : StrippedLocation  =  { 
48+     host : window . location . host , 
49+     pathname : window . location . pathname , 
50+   } 
51+   const  detectionResults  =  [ ] 
52+   for  ( const  textarea  of  textareas )  { 
53+     const  enhanced  =  enhancers . tryToEnhance ( textarea ,  location ) 
54+     const  forValue  =  `id=${ textarea . id }   name=${ textarea . name }   className=${ textarea . className }  ` 
55+     detectionResults . push ( { 
56+       for : forValue , 
57+       spot : enhanced  ? enhanced . spot  : 'NO_SPOT' , 
58+     } ) 
59+   } 
60+   return  detectionResults 
61+ } 
62+ 
4163// Fluent interface for any corpus type (HAR or HTML) 
4264export  function  withCorpus ( corpusKey : keyof  typeof  CORPUS )  { 
4365  return  { 
0 commit comments