1+ import http from 'http' ;
12import https from 'https' ;
23import { describe , it , beforeEach , afterEach , expect , vi } from 'vitest' ;
34import fs from 'fs' ;
@@ -15,7 +16,7 @@ import fs from 'fs';
1516 TODO: Find root cause of this error and fix it
1617 https://github.com/finos/git-proxy/issues/1294
1718*/
18- describe . skip ( 'Proxy Module TLS Certificate Loading' , ( ) => {
19+ describe ( 'Proxy Module TLS Certificate Loading' , ( ) => {
1920 let proxyModule : any ;
2021 let mockConfig : any ;
2122 let mockHttpServer : any ;
@@ -82,12 +83,17 @@ describe.skip('Proxy Module TLS Certificate Loading', () => {
8283 } ;
8384 } ) ;
8485
85- vi . doMock ( '../src/db' , ( ) => ( {
86- getRepos : mockDb . getRepos ,
87- createRepo : mockDb . createRepo ,
88- addUserCanPush : mockDb . addUserCanPush ,
89- addUserCanAuthorise : mockDb . addUserCanAuthorise ,
90- } ) ) ;
86+ vi . doMock ( '../src/db' , async ( importOriginal ) => {
87+ const actual : any = await importOriginal ( ) ;
88+ return {
89+ ...actual ,
90+ getRepos : mockDb . getRepos ,
91+ createRepo : mockDb . createRepo ,
92+ addUserCanPush : mockDb . addUserCanPush ,
93+ addUserCanAuthorise : mockDb . addUserCanAuthorise ,
94+ getAllProxiedHosts : vi . fn ( ) . mockResolvedValue ( [ ] ) ,
95+ } ;
96+ } ) ;
9197
9298 vi . doMock ( '../src/proxy/chain' , async ( importOriginal ) => {
9399 const actual : any = await importOriginal ( ) ;
@@ -97,10 +103,9 @@ describe.skip('Proxy Module TLS Certificate Loading', () => {
97103 } ;
98104 } ) ;
99105
100- vi . spyOn ( https , 'createServer' ) . mockReturnValue ( {
101- listen : vi . fn ( ) . mockReturnThis ( ) ,
102- close : vi . fn ( ) ,
103- } as any ) ;
106+ vi . spyOn ( http , 'createServer' ) . mockReturnValue ( mockHttpServer ) ;
107+
108+ vi . spyOn ( https , 'createServer' ) . mockReturnValue ( mockHttpsServer ) ;
104109
105110 const ProxyClass = ( await import ( '../src/proxy/index' ) ) . Proxy ;
106111 proxyModule = new ProxyClass ( ) ;
0 commit comments