@@ -256,7 +256,10 @@ describe("BinaryManager", () => {
256256
257257 it ( "handles 404 platform not supported" , async ( ) => {
258258 withHttpResponse ( 404 ) ;
259- mockUI . setResponse ( "Open an Issue" ) ;
259+ mockUI . setResponse (
260+ "Coder isn't supported for your platform. Please open an issue, we'd love to support it!" ,
261+ "Open an Issue" ,
262+ ) ;
260263 await expect ( manager . fetchBinary ( mockApi , "test" ) ) . rejects . toThrow (
261264 "Platform not supported" ,
262265 ) ;
@@ -271,7 +274,10 @@ describe("BinaryManager", () => {
271274
272275 it ( "handles server errors" , async ( ) => {
273276 withHttpResponse ( 500 ) ;
274- mockUI . setResponse ( "Open an Issue" ) ;
277+ mockUI . setResponse (
278+ "Failed to download binary. Please open an issue." ,
279+ "Open an Issue" ,
280+ ) ;
275281 await expect ( manager . fetchBinary ( mockApi , "test" ) ) . rejects . toThrow (
276282 "Failed to download binary" ,
277283 ) ;
@@ -352,16 +358,10 @@ describe("BinaryManager", () => {
352358 it ( "tries fallback signature on 404" , async ( ) => {
353359 withSuccessfulDownload ( ) ;
354360 withSignatureResponses ( [ 404 , 200 ] ) ;
355- mockUI . setResponse ( "Download signature" ) ;
361+ mockUI . setResponse ( "Signature not found" , " Download signature") ;
356362 const result = await manager . fetchBinary ( mockApi , "test" ) ;
357363 expect ( result ) . toBe ( BINARY_PATH ) ;
358- expect ( vscode . window . showWarningMessage ) . toHaveBeenCalledWith (
359- "Signature not found" ,
360- expect . any ( Object ) ,
361- expect . any ( String ) ,
362- expect . any ( String ) ,
363- ) ;
364- // First download and when verfiying twice (404 then 200)
364+ // First download and then verfiying twice (404 then 200)
365365 expect ( mockAxios . get ) . toHaveBeenCalledTimes ( 3 ) ;
366366 } ) ;
367367
@@ -371,7 +371,7 @@ describe("BinaryManager", () => {
371371 vi . mocked ( pgp . verifySignature ) . mockRejectedValueOnce (
372372 createVerificationError ( "Invalid signature" ) ,
373373 ) ;
374- mockUI . setResponse ( "Run anyway" ) ;
374+ mockUI . setResponse ( "Signature does not match" , " Run anyway") ;
375375 const result = await manager . fetchBinary ( mockApi , "test" ) ;
376376 expect ( result ) . toBe ( BINARY_PATH ) ;
377377 expect ( mockLogger . info ) . toHaveBeenCalledWith (
@@ -385,7 +385,7 @@ describe("BinaryManager", () => {
385385 vi . mocked ( pgp . verifySignature ) . mockRejectedValueOnce (
386386 createVerificationError ( "Invalid signature" ) ,
387387 ) ;
388- mockUI . setResponse ( undefined ) ;
388+ mockUI . setResponse ( "Signature does not match" , undefined ) ;
389389 await expect ( manager . fetchBinary ( mockApi , "test" ) ) . rejects . toThrow (
390390 "Signature verification aborted" ,
391391 ) ;
@@ -405,7 +405,7 @@ describe("BinaryManager", () => {
405405 it ( "allows skipping verification on 404" , async ( ) => {
406406 withSuccessfulDownload ( ) ;
407407 withHttpResponse ( 404 ) ;
408- mockUI . setResponse ( "Run without verification" ) ;
408+ mockUI . setResponse ( "Signature not found" , " Run without verification") ;
409409 const result = await manager . fetchBinary ( mockApi , "test" ) ;
410410 expect ( result ) . toBe ( BINARY_PATH ) ;
411411 expect ( pgp . verifySignature ) . not . toHaveBeenCalled ( ) ;
@@ -417,21 +417,19 @@ describe("BinaryManager", () => {
417417 it ( "handles signature download failure" , async ( ) => {
418418 withSuccessfulDownload ( ) ;
419419 withHttpResponse ( 500 ) ;
420- mockUI . setResponse ( "Run without verification" ) ;
421- const result = await manager . fetchBinary ( mockApi , "test" ) ;
422- expect ( result ) . toBe ( BINARY_PATH ) ;
423- expect ( vscode . window . showWarningMessage ) . toHaveBeenCalledWith (
420+ mockUI . setResponse (
424421 "Failed to download signature" ,
425- expect . any ( Object ) ,
426- "Download signature" , // from the next source
427422 "Run without verification" ,
428423 ) ;
424+ const result = await manager . fetchBinary ( mockApi , "test" ) ;
425+ expect ( result ) . toBe ( BINARY_PATH ) ;
426+ // TODO test that a file was run?
429427 } ) ;
430428
431429 it ( "aborts when user declines missing signature" , async ( ) => {
432430 withSuccessfulDownload ( ) ;
433431 withHttpResponse ( 404 ) ;
434- mockUI . setResponse ( undefined ) ; // User cancels
432+ mockUI . setResponse ( "Signature not found" , undefined ) ; // User cancels
435433 await expect ( manager . fetchBinary ( mockApi , "test" ) ) . rejects . toThrow (
436434 "Signature download aborted" ,
437435 ) ;
@@ -602,6 +600,7 @@ describe("BinaryManager", () => {
602600 pgp . VerificationErrorCode . Invalid ,
603601 msg ,
604602 ) ;
603+ vi . mocked ( error . summary ) . mockReturnValue ( "Signature does not match" ) ;
605604 return error ;
606605 }
607606} ) ;
0 commit comments