From 6fb866f80743820e68b701dbfe1cd4098460c22d Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Thu, 18 May 2023 12:02:09 +0200 Subject: [PATCH] Format: Increase amount of retries for Dotnet installation scripts tests --- __tests__/installation-scripts.test.ts | 82 +++++++++++++++----------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/__tests__/installation-scripts.test.ts b/__tests__/installation-scripts.test.ts index 2704b16..ce71ea7 100644 --- a/__tests__/installation-scripts.test.ts +++ b/__tests__/installation-scripts.test.ts @@ -2,43 +2,59 @@ import path from 'path'; import fs from 'fs'; import * as hc from '@actions/http-client'; -const HTTP_CLIENT_OPTIONS = { allowRetries: true, maxRetries: 10 } as const; +const HTTP_CLIENT_OPTIONS = {allowRetries: true, maxRetries: 10} as const; const TEST_TIMEOUT = 30000; describe('Dotnet installation scripts tests', () => { - it('Uses an up to date bash download script', async () => { - const httpCallbackClient = new hc.HttpClient('setup-dotnet-test', [], HTTP_CLIENT_OPTIONS); - const response: hc.HttpClientResponse = await httpCallbackClient.get( - 'https://dot.net/v1/dotnet-install.sh' - ); - expect(response.message.statusCode).toBe(200); - const upToDateContents: string = await response.readBody(); - const currentContents: string = fs - .readFileSync( - path.join(__dirname, '..', 'externals', 'install-dotnet.sh') - ) - .toString(); - expect(normalizeFileContents(currentContents)).toBe( - normalizeFileContents(upToDateContents) - ); - }, TEST_TIMEOUT); + it( + 'Uses an up to date bash download script', + async () => { + const httpCallbackClient = new hc.HttpClient( + 'setup-dotnet-test', + [], + HTTP_CLIENT_OPTIONS + ); + const response: hc.HttpClientResponse = await httpCallbackClient.get( + 'https://dot.net/v1/dotnet-install.sh' + ); + expect(response.message.statusCode).toBe(200); + const upToDateContents: string = await response.readBody(); + const currentContents: string = fs + .readFileSync( + path.join(__dirname, '..', 'externals', 'install-dotnet.sh') + ) + .toString(); + expect(normalizeFileContents(currentContents)).toBe( + normalizeFileContents(upToDateContents) + ); + }, + TEST_TIMEOUT + ); - it('Uses an up to date powershell download script', async () => { - const httpCallbackClient = new hc.HttpClient('setup-dotnet-test', [], HTTP_CLIENT_OPTIONS); - const response: hc.HttpClientResponse = await httpCallbackClient.get( - 'https://dot.net/v1/dotnet-install.ps1' - ); - expect(response.message.statusCode).toBe(200); - const upToDateContents: string = await response.readBody(); - const currentContents: string = fs - .readFileSync( - path.join(__dirname, '..', 'externals', 'install-dotnet.ps1') - ) - .toString(); - expect(normalizeFileContents(currentContents)).toBe( - normalizeFileContents(upToDateContents) - ); - }, TEST_TIMEOUT); + it( + 'Uses an up to date powershell download script', + async () => { + const httpCallbackClient = new hc.HttpClient( + 'setup-dotnet-test', + [], + HTTP_CLIENT_OPTIONS + ); + const response: hc.HttpClientResponse = await httpCallbackClient.get( + 'https://dot.net/v1/dotnet-install.ps1' + ); + expect(response.message.statusCode).toBe(200); + const upToDateContents: string = await response.readBody(); + const currentContents: string = fs + .readFileSync( + path.join(__dirname, '..', 'externals', 'install-dotnet.ps1') + ) + .toString(); + expect(normalizeFileContents(currentContents)).toBe( + normalizeFileContents(upToDateContents) + ); + }, + TEST_TIMEOUT + ); }); function normalizeFileContents(contents: string): string {