@@ -5,24 +5,33 @@ import defineBadges from './badges.js';
55
66describe ( 'badges for publishable project types' , async ( ) => {
77 const packageName = any . word ( ) ;
8+ const registryPage = any . url ( ) ;
89 const npmBadgeDetails = {
910 img : `https://img.shields.io/npm/v/${ packageName } ?logo=npm` ,
1011 text : 'npm' ,
11- link : `https://www.npmjs.com/package/ ${ packageName } `
12+ link : registryPage
1213 } ;
1314
14- it ( 'should define the badges when the access level is not public' , ( ) => {
15- expect ( defineBadges ( packageName ) ) . toEqual ( { consumer : { } , status : { } } ) ;
15+ it ( 'should note define the badges when the access level is not public' , ( ) => {
16+ expect ( defineBadges ( { packageName} ) ) . toEqual ( { consumer : { } , status : { } } ) ;
1617 } ) ;
1718
1819 it ( 'should return the npm badge for packages with a public access level' , ( ) => {
19- expect ( defineBadges ( { packageName, accessLevel : 'public' } ) . consumer ) . toEqual ( { npm : npmBadgeDetails } ) ;
20+ expect ( defineBadges ( {
21+ packageName,
22+ accessLevel : 'public' ,
23+ registryPage
24+ } ) . consumer ) . toEqual ( { npm : npmBadgeDetails } ) ;
2025 } ) ;
2126
2227 it ( 'should include the registry_uri in the npm badge when a custom registry is provided' , ( ) => {
2328 const customRegistry = any . url ( ) ;
2429
25- const { searchParams} = new URL ( defineBadges ( { packageName, accessLevel : 'public' , customRegistry} ) . consumer . npm . img ) ;
30+ const { searchParams} = new URL ( defineBadges ( {
31+ packageName,
32+ accessLevel : 'public' ,
33+ customRegistry
34+ } , `https://www.npmjs.com/package/${ packageName } ` ) . consumer . npm . img ) ;
2635
2736 expect ( searchParams . get ( 'registry_uri' ) ) . toEqual ( customRegistry ) ;
2837 } ) ;
0 commit comments