File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
packages/mongodb-memory-server-core/src/util/__tests__ Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,25 @@ describe('MongoBinary', () => {
7777 expect ( MongoBinary . download ) . toHaveBeenCalledTimes ( 1 ) ;
7878 } ) ;
7979
80+ it ( 'should not trigger an download an error if "RUNTIME_DOWNLOAD" is false and no binary is found' , async ( ) => {
81+ process . env [ envName ( ResolveConfigVariables . RUNTIME_DOWNLOAD ) ] = 'false' ;
82+ jest . spyOn ( DryMongoBinary , 'locateBinary' ) . mockResolvedValue ( undefined ) ;
83+ jest
84+ . spyOn ( MongoBinary , 'download' )
85+ . mockImplementation ( ( ) => fail ( 'Expect this function to not have been called' ) ) ;
86+
87+ try {
88+ await MongoBinary . getPath ( ) ;
89+ fail ( 'Expected "getPath" to fail' ) ;
90+ } catch ( err ) {
91+ expect ( err . message ) . toEqual (
92+ 'MongoBinary.getPath: could not find an valid binary path! (Got: "undefined", RUNTIME_DOWNLOAD: "false")'
93+ ) ;
94+ expect ( DryMongoBinary . locateBinary ) . toBeCalledTimes ( 1 ) ;
95+ expect ( MongoBinary . download ) . not . toHaveBeenCalled ( ) ;
96+ }
97+ } ) ;
98+
8099 describe ( 'systemBinary' , ( ) => {
81100 const sysBinaryPath = '/path/to/binary' ;
82101 beforeEach ( ( ) => {
You can’t perform that action at this time.
0 commit comments