@@ -435,27 +435,33 @@ describe('Storage', () => {
435435 delete process . env . STORAGE_EMULATOR_HOST ;
436436 } ) ;
437437
438- it ( 'should set baseUrl to env var STORAGE_EMULATOR_HOST' , ( ) => {
438+ it ( 'should set baseUrl to env var STORAGE_EMULATOR_HOST plus standard path ' , ( ) => {
439439 const storage = new Storage ( {
440440 projectId : PROJECT_ID ,
441441 } ) ;
442442
443443 const calledWith = storage . calledWith_ [ 0 ] ;
444- assert . strictEqual ( calledWith . baseUrl , EMULATOR_HOST ) ;
444+ assert . strictEqual ( calledWith . baseUrl , EMULATOR_HOST + '/storage/v1' ) ;
445445 assert . strictEqual (
446446 calledWith . apiEndpoint ,
447447 'https://internal.benchmark.com/path'
448448 ) ;
449449 } ) ;
450450
451- it ( 'should be overriden by apiEndpoint' , ( ) => {
451+ it ( 'should be overridden by apiEndpoint' , ( ) => {
452452 const storage = new Storage ( {
453453 projectId : PROJECT_ID ,
454454 apiEndpoint : 'https://some.api.com' ,
455455 } ) ;
456456
457457 const calledWith = storage . calledWith_ [ 0 ] ;
458- assert . strictEqual ( calledWith . baseUrl , EMULATOR_HOST ) ;
458+ // NOTE: this used to assert partially the opposite of what the test
459+ // says: it checked that baseUrl was _not_ overridden, but apiEndpoint
460+ // was.
461+ assert . strictEqual (
462+ calledWith . baseUrl ,
463+ 'https://some.api.com/storage/v1'
464+ ) ;
459465 assert . strictEqual ( calledWith . apiEndpoint , 'https://some.api.com' ) ;
460466 } ) ;
461467
@@ -468,7 +474,13 @@ describe('Storage', () => {
468474 } ) ;
469475
470476 const calledWith = storage . calledWith_ [ 0 ] ;
471- assert . strictEqual ( calledWith . baseUrl , EMULATOR_HOST ) ;
477+ // NOTE: this used to assert partially the opposite of what the test
478+ // says: it checked that baseUrl was _not_ overridden, but apiEndpoint
479+ // was.
480+ assert . strictEqual (
481+ calledWith . baseUrl ,
482+ 'https://internal.benchmark.com/path/storage/v1'
483+ ) ;
472484 assert . strictEqual (
473485 calledWith . apiEndpoint ,
474486 'https://internal.benchmark.com/path'
0 commit comments