@@ -138,76 +138,6 @@ Host *
138138 } )
139139} )
140140
141- it ( "removes old coder SSH config and adds the new one" , async ( ) => {
142- const existentSSHConfig = `Host coder-vscode--*
143- ConnectTimeout=0
144- HostName coder.something
145- LogLevel ERROR
146- ProxyCommand command
147- StrictHostKeyChecking=no
148- UserKnownHostsFile=/dev/null`
149- mockFileSystem . readFile . mockResolvedValueOnce ( existentSSHConfig )
150-
151- const sshConfig = new SSHConfig ( sshFilePath , mockFileSystem )
152- await sshConfig . load ( )
153- await sshConfig . update ( {
154- Host : "coder-vscode--*" ,
155- ProxyCommand : "some-command-here" ,
156- ConnectTimeout : "0" ,
157- StrictHostKeyChecking : "no" ,
158- UserKnownHostsFile : "/dev/null" ,
159- LogLevel : "ERROR" ,
160- } )
161-
162- const expectedOutput = `# --- START CODER VSCODE ---
163- Host coder-vscode--*
164- ConnectTimeout 0
165- LogLevel ERROR
166- ProxyCommand some-command-here
167- StrictHostKeyChecking no
168- UserKnownHostsFile /dev/null
169- # --- END CODER VSCODE ---`
170-
171- expect ( mockFileSystem . writeFile ) . toBeCalledWith ( sshFilePath , expectedOutput , {
172- encoding : "utf-8" ,
173- mode : 384 ,
174- } )
175- } )
176-
177- it ( "it does not remove a user-added block that only matches the host of an old coder SSH config" , async ( ) => {
178- const existentSSHConfig = `Host coder-vscode--*
179- ForwardAgent=yes`
180- mockFileSystem . readFile . mockResolvedValueOnce ( existentSSHConfig )
181-
182- const sshConfig = new SSHConfig ( sshFilePath , mockFileSystem )
183- await sshConfig . load ( )
184- await sshConfig . update ( {
185- Host : "coder-vscode--*" ,
186- ProxyCommand : "some-command-here" ,
187- ConnectTimeout : "0" ,
188- StrictHostKeyChecking : "no" ,
189- UserKnownHostsFile : "/dev/null" ,
190- LogLevel : "ERROR" ,
191- } )
192-
193- const expectedOutput = `Host coder-vscode--*
194- ForwardAgent=yes
195-
196- # --- START CODER VSCODE ---
197- Host coder-vscode--*
198- ConnectTimeout 0
199- LogLevel ERROR
200- ProxyCommand some-command-here
201- StrictHostKeyChecking no
202- UserKnownHostsFile /dev/null
203- # --- END CODER VSCODE ---`
204-
205- expect ( mockFileSystem . writeFile ) . toBeCalledWith ( sshFilePath , expectedOutput , {
206- encoding : "utf-8" ,
207- mode : 384 ,
208- } )
209- } )
210-
211141it ( "override values" , async ( ) => {
212142 mockFileSystem . readFile . mockRejectedValueOnce ( "No file found" )
213143 const sshConfig = new SSHConfig ( sshFilePath , mockFileSystem )
0 commit comments