@@ -53,6 +53,32 @@ MONGOMS_MD5_CHECK environment variable`, () => {
5353 expect ( callArg1 . agent . proxy . href ) . toBe ( 'http://user:pass@proxy:8080/' ) ;
5454 } ) ;
5555
56+ it ( 'should not reject unauthorized when strict-ssl is false in env vars' , async ( ) => {
57+ process . env [ 'npm_config_strict-ssl' ] = 'false' ;
58+
59+ const du = new MongoBinaryDownload ( { } ) ;
60+ du . httpDownload = jest . fn ( ) ;
61+
62+ await du . download ( 'https://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-3.6.3.tgz' ) ;
63+ expect ( du . httpDownload ) . toHaveBeenCalledTimes ( 1 ) ;
64+ const callArg1 = ( du . httpDownload as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
65+ expect ( callArg1 . rejectUnauthorized ) . toBeDefined ( ) ;
66+ expect ( callArg1 . rejectUnauthorized ) . toBe ( false ) ;
67+ } ) ;
68+
69+ it ( 'should reject unauthorized when strict-ssl is not in env vars' , async ( ) => {
70+ delete process . env [ 'npm_config_strict-ssl' ] ;
71+
72+ const du = new MongoBinaryDownload ( { } ) ;
73+ du . httpDownload = jest . fn ( ) ;
74+
75+ await du . download ( 'https://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-3.6.3.tgz' ) ;
76+ expect ( du . httpDownload ) . toHaveBeenCalledTimes ( 1 ) ;
77+ const callArg1 = ( du . httpDownload as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
78+ expect ( callArg1 . rejectUnauthorized ) . toBeDefined ( ) ;
79+ expect ( callArg1 . rejectUnauthorized ) . toBe ( true ) ;
80+ } ) ;
81+
5682 it ( `makeMD5check returns true if md5 of downloaded mongoDBArchive is
5783the same as in the reference result` , ( ) => {
5884 const someMd5 = 'md5' ;
0 commit comments