@@ -317,14 +317,14 @@ <h3>Tests Passed: ${passed}/${total} (${percentage}%)</h3>
317317 }
318318 const data = await response . json ( ) ;
319319
320- testResults [ 'search' ] = ( status === 200 || status === 208 ) && Array . isArray ( data ) ;
320+ testResults [ 'search' ] = ( status === 200 || status === 208 ) && data . results && Array . isArray ( data . results ) ;
321321
322322 if ( testResults [ 'search' ] ) {
323323 resultDiv . className = 'result success' ;
324- resultDiv . textContent = `✅ Search working!\nFound ${ data . length } results\nSample: ${ JSON . stringify ( data . slice ( 0 , 3 ) , null , 2 ) } ` ;
324+ resultDiv . textContent = `✅ Search working!\nFound ${ data . count } total results (showing ${ data . results . length } ) \nSample: ${ JSON . stringify ( data . results . slice ( 0 , 2 ) , null , 2 ) } ` ;
325325 } else {
326326 resultDiv . className = 'result error' ;
327- resultDiv . textContent = `❌ Search failed\nStatus: ${ response . status } ` ;
327+ resultDiv . textContent = `❌ Search failed\nStatus: ${ status } \nData structure: ${ JSON . stringify ( Object . keys ( data ) , null , 2 ) } ` ;
328328 }
329329 } catch ( error ) {
330330 testResults [ 'search' ] = false ;
@@ -352,14 +352,14 @@ <h3>Tests Passed: ${passed}/${total} (${percentage}%)</h3>
352352 }
353353 const data = await response . json ( ) ;
354354
355- testResults [ 'search-source' ] = ( status === 200 || status === 208 ) && Array . isArray ( data ) ;
355+ testResults [ 'search-source' ] = ( status === 200 || status === 208 ) && data . results && Array . isArray ( data . results ) ;
356356
357357 if ( testResults [ 'search-source' ] ) {
358358 resultDiv . className = 'result success' ;
359- resultDiv . textContent = `✅ Source filter working!\nFound ${ data . length } FRED results\nSample: ${ JSON . stringify ( data . slice ( 0 , 2 ) , null , 2 ) } ` ;
359+ resultDiv . textContent = `✅ Source filter working!\nFound ${ data . count } total FRED results (showing ${ data . results . length } ) \nSample: ${ JSON . stringify ( data . results . slice ( 0 , 2 ) , null , 2 ) } ` ;
360360 } else {
361361 resultDiv . className = 'result error' ;
362- resultDiv . textContent = `❌ Source filter failed\nStatus: ${ response . status } ` ;
362+ resultDiv . textContent = `❌ Source filter failed\nStatus: ${ status } ` ;
363363 }
364364 } catch ( error ) {
365365 testResults [ 'search-source' ] = false ;
@@ -387,14 +387,14 @@ <h3>Tests Passed: ${passed}/${total} (${percentage}%)</h3>
387387 }
388388 const data = await response . json ( ) ;
389389
390- testResults [ `browse-${ source } ` ] = ( status === 200 || status === 208 ) && Array . isArray ( data ) ;
390+ testResults [ `browse-${ source } ` ] = ( status === 200 || status === 208 ) && data . results && Array . isArray ( data . results ) ;
391391
392392 if ( testResults [ `browse-${ source } ` ] ) {
393393 resultDiv . className = 'result success' ;
394- resultDiv . textContent = `✅ Browse ${ source } working!\nFound ${ data . length } series\nSamples:\n${ JSON . stringify ( data . slice ( 0 , 3 ) . map ( s => ( { id : s . id , title : s . title } ) ) , null , 2 ) } ` ;
394+ resultDiv . textContent = `✅ Browse ${ source } working!\nFound ${ data . count } total series (showing ${ data . results . length } ) \nSamples:\n${ JSON . stringify ( data . results . slice ( 0 , 3 ) . map ( s => ( { id : s . id , title : s . title } ) ) , null , 2 ) } ` ;
395395 } else {
396396 resultDiv . className = 'result error' ;
397- resultDiv . textContent = `❌ Browse failed\nStatus: ${ response . status } ` ;
397+ resultDiv . textContent = `❌ Browse failed\nStatus: ${ status } \nData structure: ${ JSON . stringify ( Object . keys ( data ) , null , 2 ) } ` ;
398398 }
399399 } catch ( error ) {
400400 testResults [ `browse-${ source } ` ] = false ;
0 commit comments