1
0
Fork 0
mirror of https://github.com/actions/toolkit synced 2025-05-11 09:32:58 +00:00

Minor fixes

This commit is contained in:
Konrad Pabjan 2020-01-30 19:53:26 -05:00
parent e6f55916d2
commit 7f482379e4
2 changed files with 37 additions and 42 deletions

View file

@ -5,7 +5,7 @@ import * as path from 'path'
import * as uploadHttpClient from '../src/upload-artifact-http-client'
import {promises as fs} from 'fs'
import {getRuntimeUrl} from '../src/config-variables'
import {HttpClient, HttpClientResponse} from '@actions/http-client/index'
import {HttpClient, HttpClientResponse} from '@actions/http-client'
import {
CreateArtifactResponse,
PatchArtifactSizeSuccessResponse
@ -268,10 +268,8 @@ describe('Upload Tests', () => {
function mockHttpPost(): void {
// eslint-disable-next-line @typescript-eslint/unbound-method
HttpClient.prototype.post = async (
requestdata,
data
): Promise<HttpClientResponse> => {
HttpClient.prototype.post = jest.fn(
async (requestdata, data): Promise<HttpClientResponse> => {
// parse the input data and use the provided artifact name as part of the response
const inputData = JSON.parse(data)
const mockMessage = new http.IncomingMessage(new net.Socket())
@ -306,6 +304,7 @@ describe('Upload Tests', () => {
})
})
}
)
}
function mockHttpSendStream(): void {

View file

@ -138,7 +138,7 @@ export async function uploadArtifactToFileContainer(
)
// eslint-disable-next-line no-console
console.log(`Total size of all the files uploaded ${fileSizes}`)
console.log(`Total size of all the files uploaded is ${fileSizes} bytes`)
return {
size: fileSizes,
failedItems: failedItemsToReport
@ -320,12 +320,8 @@ export async function patchArtifactSize(
if (rawResponse.message.statusCode === 200) {
const successResponse: PatchArtifactSizeSuccessResponse = JSON.parse(body)
// eslint-disable-next-line no-console
console.log(
`Artifact ${artifactName} uploaded successfully, total size ${size}`
)
// eslint-disable-next-line no-console
console.log(successResponse)
debug(`Artifact ${artifactName} uploaded successfully, total size ${size}`)
debug(successResponse.toString())
} else if (rawResponse.message.statusCode === 404) {
throw new Error(`An Artifact with the name ${artifactName} was not found`)
} else {