Fix linting
This commit is contained in:
@@ -3,7 +3,7 @@ import * as http from 'http'
|
|||||||
import * as net from 'net'
|
import * as net from 'net'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
import {HttpClient, HttpClientResponse} from '@actions/http-client'
|
import {HttpClient} from '@actions/http-client'
|
||||||
import type {RestEndpointMethods} from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types'
|
import type {RestEndpointMethods} from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types'
|
||||||
import archiver from 'archiver'
|
import archiver from 'archiver'
|
||||||
|
|
||||||
@@ -624,9 +624,7 @@ describe('download-artifact', () => {
|
|||||||
|
|
||||||
describe('streamExtractExternal', () => {
|
describe('streamExtractExternal', () => {
|
||||||
it('should fail if the timeout is exceeded', async () => {
|
it('should fail if the timeout is exceeded', async () => {
|
||||||
|
const mockSlowGetArtifact = jest.fn(mockGetArtifactHung)
|
||||||
const mockSlowGetArtifact = jest
|
|
||||||
.fn(mockGetArtifactHung)
|
|
||||||
|
|
||||||
const mockHttpClient = (HttpClient as jest.Mock).mockImplementation(
|
const mockHttpClient = (HttpClient as jest.Mock).mockImplementation(
|
||||||
() => {
|
() => {
|
||||||
@@ -640,10 +638,10 @@ describe('download-artifact', () => {
|
|||||||
await streamExtractExternal(
|
await streamExtractExternal(
|
||||||
fixtures.blobStorageUrl,
|
fixtures.blobStorageUrl,
|
||||||
fixtures.workspaceDir,
|
fixtures.workspaceDir,
|
||||||
{ timeout: 2 }
|
{timeout: 2}
|
||||||
)
|
)
|
||||||
expect(true).toBe(false) // should not be called
|
expect(true).toBe(false) // should not be called
|
||||||
} catch (e: any) {
|
} catch (e) {
|
||||||
expect(e).toBeInstanceOf(Error)
|
expect(e).toBeInstanceOf(Error)
|
||||||
expect(e.message).toContain('did not respond in 2ms')
|
expect(e.message).toContain('did not respond in 2ms')
|
||||||
expect(mockHttpClient).toHaveBeenCalledWith(getUserAgentString())
|
expect(mockHttpClient).toHaveBeenCalledWith(getUserAgentString())
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ async function streamExtract(
|
|||||||
export async function streamExtractExternal(
|
export async function streamExtractExternal(
|
||||||
url: string,
|
url: string,
|
||||||
directory: string,
|
directory: string,
|
||||||
opts: { timeout: number } = { timeout: 30 * 1000 }
|
opts: {timeout: number} = {timeout: 30 * 1000}
|
||||||
): Promise<StreamExtractResponse> {
|
): Promise<StreamExtractResponse> {
|
||||||
const client = new httpClient.HttpClient(getUserAgentString())
|
const client = new httpClient.HttpClient(getUserAgentString())
|
||||||
const response = await client.get(url)
|
const response = await client.get(url)
|
||||||
|
|||||||
Reference in New Issue
Block a user