File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed
Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,9 @@ Configuration and logs are stored in:
6565
6666If you encounter issues:
6767
68- 1 . Run ` cloudsqlctl doctor ` to check for common problems.
69- 2 . Check the logs in ` %LOCALAPPDATA%\CloudSQLCTL\logs ` .
70- 3 . Ensure ` gcloud ` is installed and authenticated (` gcloud auth login ` ).
68+ 1 . Run ` cloudsqlctl doctor ` to check for common problems.
69+ 2 . Check the logs in ` %LOCALAPPDATA%\CloudSQLCTL\logs ` .
70+ 3 . Ensure ` gcloud ` is installed and authenticated (` gcloud auth login ` ).
7171
7272## Contributing
7373
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ jest.unstable_mockModule('fs-extra', () => ({
1414
1515// Mock execa
1616jest . unstable_mockModule ( 'execa' , ( ) => ( {
17- default : jest . fn ( ) ,
17+ execa : jest . fn ( ) ,
1818} ) ) ;
1919
2020// Mock child_process
@@ -34,15 +34,24 @@ describe('Proxy Module', () => {
3434 } ) ;
3535
3636 it ( 'should return false if PID file does not exist' , async ( ) => {
37- ( fs . pathExists as jest . Mock ) . mockReturnValue ( Promise . resolve ( false ) ) ;
37+ ( fs . pathExists as unknown as jest . Mock ) . mockReturnValue ( Promise . resolve ( false ) ) ;
3838 const running = await isRunning ( ) ;
3939 expect ( running ) . toBe ( false ) ;
4040 } ) ;
4141
4242 it ( 'should start proxy if not running' , async ( ) => {
43- ( fs . pathExists as jest . Mock ) . mockReturnValue ( Promise . resolve ( false ) ) ;
43+ ( fs . pathExists as unknown as jest . Mock ) . mockReturnValue ( Promise . resolve ( false ) ) ;
4444 const pid = await startProxy ( 'test-connection' ) ;
4545 expect ( pid ) . toBe ( 12345 ) ;
4646 expect ( fs . writeFile ) . toHaveBeenCalled ( ) ;
4747 } ) ;
48+
49+ it ( 'should stop proxy if running' , async ( ) => {
50+ ( fs . pathExists as unknown as jest . Mock ) . mockReturnValue ( Promise . resolve ( true ) ) ;
51+ ( fs . readFile as unknown as jest . Mock ) . mockReturnValue ( Promise . resolve ( '12345' ) ) ;
52+
53+ await stopProxy ( ) ;
54+
55+ expect ( fs . remove ) . toHaveBeenCalled ( ) ;
56+ } ) ;
4857} ) ;
You can’t perform that action at this time.
0 commit comments