@@ -5,16 +5,23 @@ import * as download from "./download"
5
5
suite ( "Download" , ( ) => {
6
6
vscode . window . showInformationMessage ( "Start download tests." )
7
7
8
+ teardown ( ( ) => {
9
+ delete process . env . CODER_MOCK_STATE
10
+ } )
11
+
8
12
test ( "binaryExists" , async ( ) => {
9
13
assert . strictEqual ( await download . binaryExists ( "sh" ) , true )
10
14
assert . strictEqual ( await download . binaryExists ( "surely-no-binary-named-like-this-exists" ) , false )
11
15
} )
12
16
13
17
test ( "execCoder" , async ( ) => {
14
- assert . strictEqual ( await download . execCoder ( "test success" ) , "success\n" )
15
- await assert . rejects ( download . execCoder ( "test fail" ) , {
18
+ assert . strictEqual ( await download . execCoder ( "--help" ) , "help\n" )
19
+
20
+ // This will attempt to authenticate first, which will fail.
21
+ process . env . CODER_MOCK_STATE = "fail"
22
+ await assert . rejects ( download . execCoder ( "--help" ) , {
16
23
name : "Error" ,
17
- message : / C o m m a n d f a i l e d : .+ t e s t f a i l / ,
24
+ message : / C o m m a n d f a i l e d : .+ - - h e l p \n s t d e r r m e s s a g e f r o m f a i l s t a t e \n / ,
18
25
} )
19
26
} )
20
27
@@ -23,6 +30,7 @@ suite("Download", () => {
23
30
name : "Error" ,
24
31
message : `Command "false" failed with code 1` ,
25
32
} )
33
+ // TODO: Test successful download.
26
34
} )
27
35
28
36
// TODO: Implement.
0 commit comments