@@ -47,6 +47,62 @@ test.describe('Compare Page', () => {
4747 const noDepColumn = grid . locator ( '.comparison-cell-nodep' )
4848 await expect ( noDepColumn ) . toBeVisible ( )
4949 } )
50+
51+ test ( 'loads install-size data for a scoped package' , async ( { page, goto } ) => {
52+ // Intercept the internal API call the browser makes for install-size.
53+ // The browser will request /api/registry/install-size/@nuxt%2Fkit (encoded slash).
54+ // Before the fix this would fail to parse and return an error; after it returns 200.
55+ const installSizeResponse = page . waitForResponse (
56+ res =>
57+ res . url ( ) . includes ( '/api/registry/install-size/' ) &&
58+ res . url ( ) . includes ( 'nuxt' ) &&
59+ res . request ( ) . method ( ) === 'GET' ,
60+ { timeout : 20_000 } ,
61+ )
62+
63+ await goto ( '/compare?packages=@nuxt/kit,vue' , { waitUntil : 'hydration' } )
64+
65+ const response = await installSizeResponse
66+ expect ( response . status ( ) ) . toBe ( 200 )
67+
68+ const body = await response . json ( )
69+ // The API should return a valid install size object, not an error
70+ expect ( body ) . toHaveProperty ( 'installSize' )
71+ } )
72+
73+ test ( 'loads analysis data for a scoped package' , async ( { page, goto } ) => {
74+ const analysisResponse = page . waitForResponse (
75+ res =>
76+ res . url ( ) . includes ( '/api/registry/analysis/' ) &&
77+ res . url ( ) . includes ( 'nuxt' ) &&
78+ res . request ( ) . method ( ) === 'GET' ,
79+ { timeout : 20_000 } ,
80+ )
81+
82+ await goto ( '/compare?packages=@nuxt/kit,vue' , { waitUntil : 'hydration' } )
83+
84+ const response = await analysisResponse
85+ expect ( response . status ( ) ) . toBe ( 200 )
86+
87+ const body = await response . json ( )
88+ expect ( body ) . toHaveProperty ( 'package' , '@nuxt/kit' )
89+ } )
90+
91+ test ( 'compare grid shows data (not all dashes) for a scoped package' , async ( {
92+ page,
93+ goto,
94+ } ) => {
95+ await goto ( '/compare?packages=@nuxt/kit,vue' , { waitUntil : 'hydration' } )
96+
97+ const grid = page . locator ( '.comparison-grid' )
98+ await expect ( grid ) . toBeVisible ( { timeout : 20_000 } )
99+
100+ // Package size row should have a value for the scoped package column,
101+ // not a dash, which would indicate the API call failed before the fix.
102+ const packageSizeRow = grid . locator ( '[data-facet="packageSize"]' )
103+ await expect ( packageSizeRow ) . toBeVisible ( { timeout : 15_000 } )
104+ await expect ( packageSizeRow . locator ( '.comparison-cell' ) . first ( ) ) . not . toContainText ( '-' )
105+ } )
50106} )
51107
52108test . describe ( 'Search Pages' , ( ) => {
0 commit comments