@@ -529,6 +529,7 @@ describe('ResolveCache', function () {
529529 var sourceId = md5 ( source ) ;
530530 var sourceDir = path . join ( cacheDir , sourceId ) ;
531531 var json = { name : 'foo' } ;
532+ var encoded ;
532533
533534 // Create some versions
534535 fs . mkdirSync ( sourceDir ) ;
@@ -538,22 +539,25 @@ describe('ResolveCache', function () {
538539 fs . writeFileSync ( path . join ( sourceDir , '0.1.0' , '.bower.json' ) , JSON . stringify ( json , null , ' ' ) ) ;
539540
540541 json . version = '0.1.0+build.4' ;
541- fs . mkdirSync ( path . join ( sourceDir , '0.1.0+build.4' ) ) ;
542- fs . writeFileSync ( path . join ( sourceDir , '0.1.0+build.4' , '.bower.json' ) , JSON . stringify ( json , null , ' ' ) ) ;
542+ encoded = encodeURIComponent ( '0.1.0+build.4' ) ;
543+ fs . mkdirSync ( path . join ( sourceDir , encoded ) ) ;
544+ fs . writeFileSync ( path . join ( sourceDir , encoded , '.bower.json' ) , JSON . stringify ( json , null , ' ' ) ) ;
543545
544546 json . version = '0.1.0+build.5' ;
545- fs . mkdirSync ( path . join ( sourceDir , '0.1.0+build.5' ) ) ;
546- fs . writeFileSync ( path . join ( sourceDir , '0.1.0+build.5' , '.bower.json' ) , JSON . stringify ( json , null , ' ' ) ) ;
547+ encoded = encodeURIComponent ( '0.1.0+build.5' ) ;
548+ fs . mkdirSync ( path . join ( sourceDir , encoded ) ) ;
549+ fs . writeFileSync ( path . join ( sourceDir , encoded , '.bower.json' ) , JSON . stringify ( json , null , ' ' ) ) ;
547550
548551 json . version = '0.1.0+build.6' ;
549- fs . mkdirSync ( path . join ( sourceDir , '0.1.0+build.6' ) ) ;
550- fs . writeFileSync ( path . join ( sourceDir , '0.1.0+build.6' , '.bower.json' ) , JSON . stringify ( json , null , ' ' ) ) ;
552+ encoded = encodeURIComponent ( '0.1.0+build.6' ) ;
553+ fs . mkdirSync ( path . join ( sourceDir , encoded ) ) ;
554+ fs . writeFileSync ( path . join ( sourceDir , encoded , '.bower.json' ) , JSON . stringify ( json , null , ' ' ) ) ;
551555
552556 resolveCache . retrieve ( source , '0.1.0+build.5' )
553557 . spread ( function ( canonicalDir , pkgMeta ) {
554558 expect ( pkgMeta ) . to . be . an ( 'object' ) ;
555559 expect ( pkgMeta . version ) . to . equal ( '0.1.0+build.5' ) ;
556- expect ( canonicalDir ) . to . equal ( path . join ( sourceDir , '0.1.0+build.5' ) ) ;
560+ expect ( canonicalDir ) . to . equal ( path . join ( sourceDir , encodeURIComponent ( '0.1.0+build.5' ) ) ) ;
557561
558562 next ( ) ;
559563 } )
0 commit comments