@@ -55,7 +55,7 @@ internals.assertCommit = (result) => {
5555 delete result . commit ;
5656} ;
5757
58- describe ( 'node-support' , ( ) => {
58+ describe ( 'detect- node-support' , ( ) => {
5959
6060 let listRemoteStub ;
6161
@@ -79,6 +79,8 @@ describe('node-support', () => {
7979 Nock . activate ( ) ;
8080 }
8181
82+ Nock . disableNetConnect ( ) ;
83+
8284 Nock ( 'https://raw.githubusercontent.com' )
8385 . persist ( )
8486 . get ( '/nodejs/Release/master/schedule.json' )
@@ -103,6 +105,7 @@ describe('node-support', () => {
103105
104106 Nock . restore ( ) ;
105107 Nock . cleanAll ( ) ;
108+ Nock . enableNetConnect ( ) ;
106109 } ) ;
107110
108111 describe ( 'detect()' , ( ) => {
@@ -118,7 +121,7 @@ describe('node-support', () => {
118121 internals . assertCommit ( result ) ;
119122
120123 expect ( result ) . to . equal ( {
121- name : 'node-support' ,
124+ name : 'detect- node-support' ,
122125 version : '0.0.0-development' ,
123126 timestamp : 1580673602000 ,
124127 travis : {
@@ -468,18 +471,18 @@ describe('node-support', () => {
468471 . returns ( '9cef39d21ad229dea4b10295f55b0d9a83800b23\tHEAD\n' ) ;
469472
470473 Nock ( 'https://raw.githubusercontent.com' )
471- . get ( '/pkgjs/node-support/HEAD/package.json' )
474+ . get ( '/pkgjs/detect- node-support/HEAD/package.json' )
472475 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , 'package.json' ) ) )
473- . get ( '/pkgjs/node-support/HEAD/.travis.yml' )
476+ . get ( '/pkgjs/detect- node-support/HEAD/.travis.yml' )
474477 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , '.travis.yml' ) ) ) ;
475478
476- const result = await NodeSupport . detect ( { repository : 'git+https://github.com/pkgjs/node-support.git' } ) ;
479+ const result = await NodeSupport . detect ( { repository : 'git+https://github.com/pkgjs/detect- node-support.git' } ) ;
477480
478481 expect ( listRemoteStub . callCount ) . to . equal ( 1 ) ;
479- expect ( listRemoteStub . args [ 0 ] ) . to . equal ( [ [ 'http://github.com/pkgjs/node-support.git' , 'HEAD' ] ] ) ;
482+ expect ( listRemoteStub . args [ 0 ] ) . to . equal ( [ [ 'http://github.com/pkgjs/detect- node-support.git' , 'HEAD' ] ] ) ;
480483
481484 expect ( result ) . to . equal ( {
482- name : 'node-support' ,
485+ name : 'detect- node-support' ,
483486 version : '0.0.0-development' ,
484487 commit : '9cef39d21ad229dea4b10295f55b0d9a83800b23' ,
485488 timestamp : 1580673602000 ,
@@ -501,24 +504,24 @@ describe('node-support', () => {
501504 . returns ( '9cef39d21ad229dea4b10295f55b0d9a83800b23\tHEAD\n' ) ;
502505
503506 Nock ( 'https://raw.githubusercontent.com' )
504- . get ( '/pkgjs/node-support/HEAD/package.json' )
507+ . get ( '/pkgjs/detect- node-support/HEAD/package.json' )
505508 . reply ( 404 )
506- . get ( '/pkgjs/node-support/HEAD/.travis.yml' )
509+ . get ( '/pkgjs/detect- node-support/HEAD/.travis.yml' )
507510 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , '.travis.yml' ) ) ) ;
508511
509- await expect ( NodeSupport . detect ( { repository : 'git+https://github.com/pkgjs/node-support.git' } ) )
510- . to . reject ( `git+https://github.com/pkgjs/node-support.git does not contain a package.json` ) ;
512+ await expect ( NodeSupport . detect ( { repository : 'git+https://github.com/pkgjs/detect- node-support.git' } ) )
513+ . to . reject ( `git+https://github.com/pkgjs/detect- node-support.git does not contain a package.json` ) ;
511514 } ) ;
512515
513516 it ( 'rethrows server errors' , async ( ) => {
514517
515518 Nock ( 'https://raw.githubusercontent.com' )
516- . get ( '/pkgjs/node-support/HEAD/package.json' )
519+ . get ( '/pkgjs/detect- node-support/HEAD/package.json' )
517520 . reply ( 500 )
518- . get ( '/pkgjs/node-support/HEAD/.travis.yml' )
521+ . get ( '/pkgjs/detect- node-support/HEAD/.travis.yml' )
519522 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , '.travis.yml' ) ) ) ;
520523
521- await expect ( NodeSupport . detect ( { repository : 'git+https://github.com/pkgjs/node-support.git' } ) )
524+ await expect ( NodeSupport . detect ( { repository : 'git+https://github.com/pkgjs/detect- node-support.git' } ) )
522525 . to . reject ( / R e s p o n s e E r r o r / ) ;
523526 } ) ;
524527
@@ -528,14 +531,14 @@ describe('node-support', () => {
528531
529532 Sinon . stub ( Wreck , 'get' ) . throws ( err ) ;
530533
531- await expect ( NodeSupport . detect ( { repository : 'git+https://github.com/pkgjs/node-support.git' } ) )
534+ await expect ( NodeSupport . detect ( { repository : 'git+https://github.com/pkgjs/detect- node-support.git' } ) )
532535 . to . reject ( 'Something went wrong' ) ;
533536 } ) ;
534537
535538 it ( 'throws when a package does not live on public github.com' , async ( ) => {
536539
537- await expect ( NodeSupport . detect ( { repository : 'git+https://github.example.com/pkgjs/node-support.git' } ) )
538- . to . reject ( 'Only github.com paths supported, feel free to PR at https://github.com/pkgjs/node-support' ) ;
540+ await expect ( NodeSupport . detect ( { repository : 'git+https://github.example.com/pkgjs/detect- node-support.git' } ) )
541+ . to . reject ( 'Only github.com paths supported, feel free to PR at https://github.com/pkgjs/detect- node-support' ) ;
539542 } ) ;
540543 } ) ;
541544
@@ -547,22 +550,22 @@ describe('node-support', () => {
547550 . returns ( '9cef39d21ad229dea4b10295f55b0d9a83800b23\tHEAD\n' ) ;
548551
549552 Nock ( 'https://raw.githubusercontent.com' )
550- . get ( '/pkgjs/node-support/HEAD/package.json' )
553+ . get ( '/pkgjs/detect- node-support/HEAD/package.json' )
551554 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , 'package.json' ) ) )
552- . get ( '/pkgjs/node-support/HEAD/.travis.yml' )
555+ . get ( '/pkgjs/detect- node-support/HEAD/.travis.yml' )
553556 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , '.travis.yml' ) ) ) ;
554557
555558 Nock ( 'https://registry.npmjs.org' )
556- . get ( '/node-support' )
559+ . get ( '/detect- node-support' )
557560 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , 'package.json' ) ) ) ;
558561
559- const result = await NodeSupport . detect ( { packageName : 'node-support' } ) ;
562+ const result = await NodeSupport . detect ( { packageName : 'detect- node-support' } ) ;
560563
561564 expect ( listRemoteStub . callCount ) . to . equal ( 1 ) ;
562- expect ( listRemoteStub . args [ 0 ] ) . to . equal ( [ [ 'http://github.com/pkgjs/node-support.git' , 'HEAD' ] ] ) ;
565+ expect ( listRemoteStub . args [ 0 ] ) . to . equal ( [ [ 'http://github.com/pkgjs/detect- node-support.git' , 'HEAD' ] ] ) ;
563566
564567 expect ( result ) . to . equal ( {
565- name : 'node-support' ,
568+ name : 'detect- node-support' ,
566569 version : '0.0.0-development' ,
567570 commit : '9cef39d21ad229dea4b10295f55b0d9a83800b23' ,
568571 timestamp : 1580673602000 ,
@@ -581,51 +584,55 @@ describe('node-support', () => {
581584 it ( 'throws when package does not exist in the registry' , async ( ) => {
582585
583586 Nock ( 'https://registry.npmjs.org' )
584- . get ( '/node-support' )
587+ . get ( '/detect- node-support' )
585588 . reply ( 404 ) ;
586589
587- await expect ( NodeSupport . detect ( { packageName : 'node-support' } ) )
588- . to . reject ( `Package node-support does not exist` ) ;
590+ await expect ( NodeSupport . detect ( { packageName : 'detect- node-support' } ) )
591+ . to . reject ( `Package detect- node-support does not exist` ) ;
589592 } ) ;
590593
591594 it ( 'rethrows registry server errors' , async ( ) => {
592595
593596 Nock ( 'https://registry.npmjs.org' )
594- . get ( '/node-support' )
597+ . get ( '/detect- node-support' )
595598 . reply ( 500 ) ;
596599
597- await expect ( NodeSupport . detect ( { packageName : 'node-support' } ) )
600+ await expect ( NodeSupport . detect ( { packageName : 'detect- node-support' } ) )
598601 . to . reject ( / I n t e r n a l S e r v e r E r r o r / ) ;
599602 } ) ;
600603
601604 it ( 'rethrows generic errors' , async ( ) => {
602605
606+ Nock ( 'https://registry.npmjs.org' )
607+ . get ( '/detect-node-support' )
608+ . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , 'package.json' ) ) ) ;
609+
603610 const err = new Error ( 'Something went wrong' ) ;
604611
605612 Sinon . stub ( Wreck , 'get' ) . throws ( err ) ;
606613
607- await expect ( NodeSupport . detect ( { packageName : 'node-support' } ) )
614+ await expect ( NodeSupport . detect ( { packageName : 'detect- node-support' } ) )
608615 . to . reject ( 'Something went wrong' ) ;
609616 } ) ;
610617
611618 it ( 'throws when packument does not contain a `repository` field' , async ( ) => {
612619
613620 Nock ( 'https://registry.npmjs.org' )
614- . get ( '/node-support' )
615- . reply ( 200 , JSON . stringify ( { name : 'node-support' } ) ) ;
621+ . get ( '/detect- node-support' )
622+ . reply ( 200 , JSON . stringify ( { name : 'detect- node-support' } ) ) ;
616623
617- await expect ( NodeSupport . detect ( { packageName : 'node-support' } ) )
618- . to . reject ( 'Unable to determine the git repository for node-support' ) ;
624+ await expect ( NodeSupport . detect ( { packageName : 'detect- node-support' } ) )
625+ . to . reject ( 'Unable to determine the git repository for detect- node-support' ) ;
619626 } ) ;
620627
621628 it ( 'throws when packument does not contain a `repository.url` field' , async ( ) => {
622629
623630 Nock ( 'https://registry.npmjs.org' )
624- . get ( '/node-support' )
625- . reply ( 200 , JSON . stringify ( { name : 'node-support' , repository : { } } ) ) ;
631+ . get ( '/detect- node-support' )
632+ . reply ( 200 , JSON . stringify ( { name : 'detect- node-support' , repository : { } } ) ) ;
626633
627- await expect ( NodeSupport . detect ( { packageName : 'node-support' } ) )
628- . to . reject ( 'Unable to determine the git repository for node-support' ) ;
634+ await expect ( NodeSupport . detect ( { packageName : 'detect- node-support' } ) )
635+ . to . reject ( 'Unable to determine the git repository for detect- node-support' ) ;
629636 } ) ;
630637
631638 it ( 'returns node versions from `.travis.yml` in the package repository (string repository)' , async ( ) => {
@@ -634,25 +641,25 @@ describe('node-support', () => {
634641 . returns ( '9cef39d21ad229dea4b10295f55b0d9a83800b23\tHEAD\n' ) ;
635642
636643 Nock ( 'https://raw.githubusercontent.com' )
637- . get ( '/pkgjs/node-support/HEAD/package.json' )
644+ . get ( '/pkgjs/detect- node-support/HEAD/package.json' )
638645 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , 'package.json' ) ) )
639- . get ( '/pkgjs/node-support/HEAD/.travis.yml' )
646+ . get ( '/pkgjs/detect- node-support/HEAD/.travis.yml' )
640647 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , '.travis.yml' ) ) ) ;
641648
642649 Nock ( 'https://registry.npmjs.org' )
643- . get ( '/node-support' )
650+ . get ( '/detect- node-support' )
644651 . reply ( 200 , JSON . stringify ( {
645- name : 'node-support' ,
646- repository : 'git+https://github.com/pkgjs/node-support.git'
652+ name : 'detect- node-support' ,
653+ repository : 'git+https://github.com/pkgjs/detect- node-support.git'
647654 } ) ) ;
648655
649- const result = await NodeSupport . detect ( { packageName : 'node-support' } ) ;
656+ const result = await NodeSupport . detect ( { packageName : 'detect- node-support' } ) ;
650657
651658 expect ( listRemoteStub . callCount ) . to . equal ( 1 ) ;
652- expect ( listRemoteStub . args [ 0 ] ) . to . equal ( [ [ 'http://github.com/pkgjs/node-support.git' , 'HEAD' ] ] ) ;
659+ expect ( listRemoteStub . args [ 0 ] ) . to . equal ( [ [ 'http://github.com/pkgjs/detect- node-support.git' , 'HEAD' ] ] ) ;
653660
654661 expect ( result ) . to . equal ( {
655- name : 'node-support' ,
662+ name : 'detect- node-support' ,
656663 version : '0.0.0-development' ,
657664 commit : '9cef39d21ad229dea4b10295f55b0d9a83800b23' ,
658665 timestamp : 1580673602000 ,
@@ -674,17 +681,17 @@ describe('node-support', () => {
674681 . returns ( '9cef39d21ad229dea4b10295f55b0d9a83800b23\tHEAD\n' ) ;
675682
676683 Nock ( 'https://raw.githubusercontent.com' )
677- . get ( '/pkgjs/node-support/HEAD/package.json' )
684+ . get ( '/pkgjs/detect- node-support/HEAD/package.json' )
678685 . reply ( 200 , JSON . stringify ( { name : 'something-else' } ) )
679- . get ( '/pkgjs/node-support/HEAD/.travis.yml' )
686+ . get ( '/pkgjs/detect- node-support/HEAD/.travis.yml' )
680687 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , '.travis.yml' ) ) ) ;
681688
682689 Nock ( 'https://registry.npmjs.org' )
683- . get ( '/node-support' )
690+ . get ( '/detect- node-support' )
684691 . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , '..' , 'package.json' ) ) ) ;
685692
686- await expect ( NodeSupport . detect ( { packageName : 'node-support' } ) )
687- . to . reject ( 'git+https://github.com/pkgjs/node-support.git does not contain node-support' ) ;
693+ await expect ( NodeSupport . detect ( { packageName : 'detect- node-support' } ) )
694+ . to . reject ( 'git+https://github.com/pkgjs/detect- node-support.git does not contain detect- node-support' ) ;
688695 } ) ;
689696 } ) ;
690697 } ) ;
0 commit comments