update download-artifact tests for public and internal impl

This commit is contained in:
Rob Herley
2023-12-01 01:32:45 +00:00
committed by GitHub
parent 22b7aeb707
commit 32549e8197
6 changed files with 224 additions and 53 deletions
@@ -6,7 +6,7 @@ import * as config from '../src/internal/shared/config'
import {Timestamp, ArtifactServiceClientJSON} from '../src/generated'
import * as blobUpload from '../src/internal/upload/blob-upload'
import {uploadArtifact} from '../src/internal/upload/upload-artifact'
import {noopLogs} from './common.test'
import {noopLogs} from './common'
describe('upload-artifact', () => {
beforeEach(() => {
@@ -127,7 +127,7 @@ describe('upload-artifact', () => {
expect(uploadResp).resolves.toEqual({success: false})
})
it('should return false if no backend IDs are found', () => {
it('should reject if no backend IDs are found', () => {
jest
.spyOn(uploadZipSpecification, 'validateRootDirectory')
.mockReturnValue()
@@ -151,9 +151,6 @@ describe('upload-artifact', () => {
jest
.spyOn(zip, 'createZipUploadStream')
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
jest
.spyOn(util, 'getBackendIdsFromToken')
.mockReturnValue({workflowRunBackendId: '', workflowJobRunBackendId: ''})
const uploadResp = uploadArtifact(
'test-artifact',
@@ -165,7 +162,7 @@ describe('upload-artifact', () => {
'/home/user/files/plz-upload'
)
expect(uploadResp).resolves.toEqual({success: false})
expect(uploadResp).rejects.toThrow()
})
it('should return false if the creation request fails', () => {