@@ -514,4 +514,74 @@ describe('Yalc package manager', function () {
514514 } )
515515 } )
516516 } )
517+
518+ describe ( 'Add package (--portal)' , ( ) => {
519+ before ( ( ) => {
520+ return addPackages ( [ values . depPackage ] , {
521+ workingDir : projectDir ,
522+ portalDep : true ,
523+ } )
524+ } )
525+ it ( 'copies package to .yalc folder' , ( ) => {
526+ checkExists ( join ( projectDir , '.yalc' , values . depPackage ) )
527+ } )
528+ it ( 'copies remove package to node_modules' , ( ) => {
529+ checkExists ( join ( projectDir , 'node_modules' , values . depPackage ) )
530+ } )
531+ it ( 'creates to yalc.lock' , ( ) => {
532+ checkExists ( join ( projectDir , 'yalc.lock' ) )
533+ } )
534+ it ( 'places yalc.lock correct info about file' , ( ) => {
535+ const lockFile = readLockfile ( { workingDir : projectDir } )
536+ deepEqual ( lockFile . packages , {
537+ [ values . depPackage ] : {
538+ portal : true ,
539+ replaced : 'link:.yalc/' + values . depPackage ,
540+ signature : extractSignature ( lockFile , values . depPackage ) ,
541+ } ,
542+ } )
543+ } )
544+ it ( 'updates package.json' , ( ) => {
545+ const pkg = readPackageManifest ( projectDir ) !
546+ deepEqual ( pkg . dependencies , {
547+ [ values . depPackage ] : 'portal:.yalc/' + values . depPackage ,
548+ } )
549+ } )
550+ it ( 'create and updates installations file' , ( ) => {
551+ const installtions = readInstallationsFile ( )
552+ deepEqual ( installtions , {
553+ [ values . depPackage ] : [ projectDir ] ,
554+ } )
555+ } )
556+ } )
557+
558+ describe ( 'Updated linked (--portal) package' , ( ) => {
559+ before ( ( ) => {
560+ return updatePackages ( [ values . depPackage ] , {
561+ workingDir : projectDir ,
562+ } )
563+ } )
564+ it ( 'places yalc.lock correct info about file' , ( ) => {
565+ const lockFile = readLockfile ( { workingDir : projectDir } )
566+ deepEqual ( lockFile . packages , {
567+ [ values . depPackage ] : {
568+ portal : true ,
569+ replaced : 'link:.yalc/' + values . depPackage ,
570+ signature : extractSignature ( lockFile , values . depPackage ) ,
571+ } ,
572+ } )
573+ } )
574+ it ( 'updates package.json' , ( ) => {
575+ const pkg = readPackageManifest ( projectDir ) !
576+ deepEqual ( pkg . dependencies , {
577+ [ values . depPackage ] : 'portal:.yalc/' + values . depPackage ,
578+ } )
579+ } )
580+ it ( 'create and updates installations file' , ( ) => {
581+ const installtions = readInstallationsFile ( )
582+ deepEqual ( installtions , {
583+ [ values . depPackage ] : [ projectDir ] ,
584+ } )
585+ } )
586+ } )
517587} )
0 commit comments