@@ -8,6 +8,7 @@ import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/tes
88import { getEntryAddress , IRemoteAgentHostEntry , IRemoteAgentHostService , RemoteAgentHostEntryType } from '../../../../../platform/agentHost/common/remoteAgentHostService.js' ;
99import { ISessionsProvidersService } from '../../../../services/sessions/browser/sessionsProvidersService.js' ;
1010import { resolveRemoteAuthority , sshAuthorityString } from '../../browser/chat.contribution.js' ;
11+ import { decodeHex } from '../../../../../base/common/buffer.js' ;
1112
1213suite ( 'resolveRemoteAuthority' , ( ) => {
1314
@@ -97,7 +98,7 @@ suite('resolveRemoteAuthority', () => {
9798 assert . ok ( result ?. startsWith ( 'ssh-remote+' ) ) ;
9899 // The authority should be hex-encoded JSON
99100 const authority = result ! . slice ( 'ssh-remote+' . length ) ;
100- const decoded = Buffer . from ( authority , 'hex' ) . toString ( 'utf-8' ) ;
101+ const decoded = decodeHex ( authority ) . toString ( ) ;
101102 assert . deepStrictEqual ( JSON . parse ( decoded ) , {
102103 hostName : 'myserver.example.com' ,
103104 user : 'admin' ,
@@ -180,7 +181,7 @@ suite('sshAuthorityString', () => {
180181 hostName : 'myserver' ,
181182 user : 'admin' ,
182183 } ) ;
183- const decoded = Buffer . from ( result , 'hex' ) . toString ( 'utf-8' ) ;
184+ const decoded = decodeHex ( result ) . toString ( ) ;
184185 assert . deepStrictEqual ( JSON . parse ( decoded ) , { hostName : 'myserver' , user : 'admin' } ) ;
185186 } ) ;
186187
@@ -191,7 +192,7 @@ suite('sshAuthorityString', () => {
191192 hostName : 'myserver' ,
192193 port : 2222 ,
193194 } ) ;
194- const decoded = Buffer . from ( result , 'hex' ) . toString ( 'utf-8' ) ;
195+ const decoded = decodeHex ( result ) . toString ( ) ;
195196 assert . deepStrictEqual ( JSON . parse ( decoded ) , { hostName : 'myserver' , port : 2222 } ) ;
196197 } ) ;
197198
@@ -201,7 +202,7 @@ suite('sshAuthorityString', () => {
201202 address : 'localhost:4321' ,
202203 hostName : 'MyServer' ,
203204 } ) ;
204- const decoded = Buffer . from ( result , 'hex' ) . toString ( 'utf-8' ) ;
205+ const decoded = decodeHex ( result ) . toString ( ) ;
205206 assert . deepStrictEqual ( JSON . parse ( decoded ) , { hostName : 'MyServer' } ) ;
206207 } ) ;
207208
@@ -213,7 +214,7 @@ suite('sshAuthorityString', () => {
213214 user : 'root' ,
214215 port : 22 ,
215216 } ) ;
216- const decoded = Buffer . from ( result , 'hex' ) . toString ( 'utf-8' ) ;
217+ const decoded = decodeHex ( result ) . toString ( ) ;
217218 assert . deepStrictEqual ( JSON . parse ( decoded ) , {
218219 hostName : 'MyServer.example.com' ,
219220 user : 'root' ,
0 commit comments