@@ -47,6 +47,48 @@ 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 ( 'selfSize' )
71+ expect ( body ) . toHaveProperty ( 'totalSize' )
72+ } )
73+
74+ test ( 'loads analysis data for a scoped package' , async ( { page, goto } ) => {
75+ const analysisResponse = page . waitForResponse (
76+ res =>
77+ res . url ( ) . includes ( '/api/registry/analysis/' ) &&
78+ res . url ( ) . includes ( 'nuxt' ) &&
79+ res . request ( ) . method ( ) === 'GET' ,
80+ { timeout : 20_000 } ,
81+ )
82+
83+ await goto ( '/compare?packages=@nuxt/kit,vue' , { waitUntil : 'hydration' } )
84+
85+ const response = await analysisResponse
86+ expect ( response . status ( ) ) . toBe ( 200 )
87+
88+ const body = await response . json ( )
89+ expect ( body ) . toHaveProperty ( 'package' , '@nuxt/kit' )
90+ expect ( body ) . toHaveProperty ( 'moduleFormat' , 'esm' )
91+ } )
5092} )
5193
5294test . describe ( 'Search Pages' , ( ) => {
0 commit comments