Skip to content

Commit b891376

Browse files
author
IvanZosimov
committed
Merge branch 'main' into add-latest-patch-syntax
2 parents b05a3f2 + 5fdecd2 commit b891376

File tree

1 file changed

+51
-38
lines changed

1 file changed

+51
-38
lines changed

__tests__/installation-scripts.test.ts

Lines changed: 51 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,59 @@ import path from 'path';
22
import fs from 'fs';
33
import * as hc from '@actions/http-client';
44

5+
const HTTP_CLIENT_OPTIONS = {allowRetries: true, maxRetries: 10} as const;
6+
const TEST_TIMEOUT = 30000;
7+
58
describe('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

4760
function normalizeFileContents(contents: string): string {

0 commit comments

Comments
 (0)