@@ -596,6 +596,52 @@ describe("executeUpgrade", () => {
596596 } ) ;
597597} ) ;
598598
599+ describe ( "detectInstallationMethod — stored info path" , ( ) => {
600+ useTestConfigDir ( "test-detect-stored-" ) ;
601+
602+ let originalExecPath : string ;
603+
604+ beforeEach ( ( ) => {
605+ originalExecPath = process . execPath ;
606+ // Set execPath to a non-Homebrew, non-known-curl path so detection falls
607+ // through to stored info
608+ Object . defineProperty ( process , "execPath" , {
609+ value : "/usr/bin/sentry" ,
610+ configurable : true ,
611+ } ) ;
612+ } ) ;
613+
614+ afterEach ( ( ) => {
615+ Object . defineProperty ( process , "execPath" , {
616+ value : originalExecPath ,
617+ configurable : true ,
618+ } ) ;
619+ clearInstallInfo ( ) ;
620+ } ) ;
621+
622+ test ( "returns stored method when install info has been persisted" , async ( ) => {
623+ setInstallInfo ( {
624+ method : "npm" ,
625+ path : "/usr/bin/sentry" ,
626+ version : "1.0.0" ,
627+ } ) ;
628+
629+ const method = await detectInstallationMethod ( ) ;
630+ expect ( method ) . toBe ( "npm" ) ;
631+ } ) ;
632+
633+ test ( "returns stored curl method" , async ( ) => {
634+ setInstallInfo ( {
635+ method : "curl" ,
636+ path : "/usr/bin/sentry" ,
637+ version : "1.0.0" ,
638+ } ) ;
639+
640+ const method = await detectInstallationMethod ( ) ;
641+ expect ( method ) . toBe ( "curl" ) ;
642+ } ) ;
643+ } ) ;
644+
599645describe ( "Homebrew detection (detectInstallationMethod)" , ( ) => {
600646 let originalExecPath : string ;
601647
0 commit comments