File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
packages/mongodb-memory-server-core/src/util/__tests__ Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 11import { promises as fspromises } from 'fs' ;
22import md5file from 'md5-file' ;
3+ import { DryMongoBinary } from '../DryMongoBinary' ;
34import MongoBinaryDownload from '../MongoBinaryDownload' ;
45import { envName , ResolveConfigVariables } from '../resolveConfig' ;
56import * as utils from '../utils' ;
@@ -142,4 +143,25 @@ describe('MongoBinaryDownload', () => {
142143 const result = await du . makeMD5check ( '' , '' ) ;
143144 expect ( result ) . toEqual ( undefined ) ;
144145 } ) ;
146+
147+ it ( 'should return the correct path to binary name (getPath)' , async ( ) => {
148+ const downloadDir = '/path/to/downloadDir' ;
149+ jest . spyOn ( DryMongoBinary , 'generateOptions' ) . mockResolvedValue ( {
150+ arch : 'x64' ,
151+ version : '4.0.20' ,
152+ downloadDir : downloadDir ,
153+ systemBinary : '' ,
154+ os : {
155+ os : 'linux' ,
156+ dist : 'ubuntu' ,
157+ release : '14' ,
158+ } ,
159+ } ) ;
160+
161+ const du = new MongoBinaryDownload ( { downloadDir } ) ;
162+
163+ // @ts -expect-error because "getPath" is "protected"
164+ const path = await du . getPath ( ) ;
165+ expect ( path ) . toEqual ( `${ downloadDir } /mongod-x64-ubuntu-4.0.20` ) ;
166+ } ) ;
145167} ) ;
You can’t perform that action at this time.
0 commit comments