@@ -422,6 +422,18 @@ test('pickRegistry() utility', t => {
422
422
'https://my.scoped.registry/here/' ,
423
423
'scope @ is option@l'
424
424
)
425
+ t . equal (
426
+ pick ( 'foo@1.2.3' , {
427
+ registry : 'https://my.registry/here/' ,
428
+ scope : '@otherscope' ,
429
+ '@myscope:registry' : 'https://my.scoped.registry/here/' ,
430
+ publishConfig : {
431
+ registry : 'https://my.package.registry'
432
+ }
433
+ } ) ,
434
+ 'https://my.package.registry' ,
435
+ 'respects publishConfig setting'
436
+ )
425
437
t . done ( )
426
438
} )
427
439
@@ -461,6 +473,34 @@ test('pickRegistry through opts.spec', t => {
461
473
) )
462
474
} )
463
475
476
+ test ( 'pickRegistry through publishConfig' , t => {
477
+ tnock ( t , OPTS . registry )
478
+ . get ( '/pkg' )
479
+ . reply ( 200 , { source : OPTS . registry } )
480
+ const publishRegistry = 'https://my.publish.registry'
481
+ tnock ( t , publishRegistry )
482
+ . get ( '/pkg' )
483
+ . reply ( 200 , { source : publishRegistry } )
484
+
485
+ return fetch . json ( '/pkg' , {
486
+ ...OPTS ,
487
+ publishConfig : { }
488
+ } ) . then ( json => t . equal (
489
+ json . source ,
490
+ OPTS . registry ,
491
+ 'request made to default registry when publishConfig specifies no registry'
492
+ ) ) . then ( ( ) => fetch . json ( '/pkg' , {
493
+ ...OPTS ,
494
+ publishConfig : {
495
+ registry : publishRegistry
496
+ }
497
+ } ) . then ( json => t . equal (
498
+ json . source ,
499
+ publishRegistry ,
500
+ 'request made to publishConfig.registry when one is specified'
501
+ ) ) )
502
+ } )
503
+
464
504
test ( 'log warning header info' , t => {
465
505
tnock ( t , OPTS . registry )
466
506
. get ( '/hello' )
0 commit comments