@@ -2,46 +2,59 @@ import path from 'path';
22import fs from 'fs' ;
33import * as hc from '@actions/http-client' ;
44
5+ const HTTP_CLIENT_OPTIONS = { allowRetries : true , maxRetries : 10 } as const ;
6+ const TEST_TIMEOUT = 30000 ;
7+
58describe ( 'Dotnet installation scripts tests' , ( ) => {
6- it ( 'Uses an up to date bash download script' , async ( ) => {
7- const httpCallbackClient = new hc . HttpClient ( 'setup-dotnet-test' , [ ] , {
8- allowRetries : true ,
9- maxRetries : 3
10- } ) ;
11- const response : hc . HttpClientResponse = await httpCallbackClient . get (
12- 'https://dot.net/v1/dotnet-install.sh'
13- ) ;
14- expect ( response . message . statusCode ) . toBe ( 200 ) ;
15- const upToDateContents : string = await response . readBody ( ) ;
16- const currentContents : string = fs
17- . readFileSync (
18- path . join ( __dirname , '..' , 'externals' , 'install-dotnet.sh' )
19- )
20- . toString ( ) ;
21- expect ( normalizeFileContents ( currentContents ) ) . toBe (
22- normalizeFileContents ( upToDateContents )
23- ) ;
24- } , 30000 ) ;
9+ it (
10+ 'Uses an up to date bash download script' ,
11+ async ( ) => {
12+ const httpCallbackClient = new hc . HttpClient (
13+ 'setup-dotnet-test' ,
14+ [ ] ,
15+ HTTP_CLIENT_OPTIONS
16+ ) ;
17+ const response : hc . HttpClientResponse = await httpCallbackClient . get (
18+ 'https://dot.net/v1/dotnet-install.sh'
19+ ) ;
20+ expect ( response . message . statusCode ) . toBe ( 200 ) ;
21+ const upToDateContents : string = await response . readBody ( ) ;
22+ const currentContents : string = fs
23+ . readFileSync (
24+ path . join ( __dirname , '..' , 'externals' , 'install-dotnet.sh' )
25+ )
26+ . toString ( ) ;
27+ expect ( normalizeFileContents ( currentContents ) ) . toBe (
28+ normalizeFileContents ( upToDateContents )
29+ ) ;
30+ } ,
31+ TEST_TIMEOUT
32+ ) ;
2533
26- it ( 'Uses an up to date powershell download script' , async ( ) => {
27- const httpCallbackClient = new hc . HttpClient ( 'setup-dotnet-test' , [ ] , {
28- allowRetries : true ,
29- maxRetries : 3
30- } ) ;
31- const response : hc . HttpClientResponse = await httpCallbackClient . get (
32- 'https://dot.net/v1/dotnet-install.ps1'
33- ) ;
34- expect ( response . message . statusCode ) . toBe ( 200 ) ;
35- const upToDateContents : string = await response . readBody ( ) ;
36- const currentContents : string = fs
37- . readFileSync (
38- path . join ( __dirname , '..' , 'externals' , 'install-dotnet.ps1' )
39- )
40- . toString ( ) ;
41- expect ( normalizeFileContents ( currentContents ) ) . toBe (
42- normalizeFileContents ( upToDateContents )
43- ) ;
44- } , 30000 ) ;
34+ it (
35+ 'Uses an up to date powershell download script' ,
36+ async ( ) => {
37+ const httpCallbackClient = new hc . HttpClient (
38+ 'setup-dotnet-test' ,
39+ [ ] ,
40+ HTTP_CLIENT_OPTIONS
41+ ) ;
42+ const response : hc . HttpClientResponse = await httpCallbackClient . get (
43+ 'https://dot.net/v1/dotnet-install.ps1'
44+ ) ;
45+ expect ( response . message . statusCode ) . toBe ( 200 ) ;
46+ const upToDateContents : string = await response . readBody ( ) ;
47+ const currentContents : string = fs
48+ . readFileSync (
49+ path . join ( __dirname , '..' , 'externals' , 'install-dotnet.ps1' )
50+ )
51+ . toString ( ) ;
52+ expect ( normalizeFileContents ( currentContents ) ) . toBe (
53+ normalizeFileContents ( upToDateContents )
54+ ) ;
55+ } ,
56+ TEST_TIMEOUT
57+ ) ;
4558} ) ;
4659
4760function normalizeFileContents ( contents : string ) : string {
0 commit comments